[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: How to sort lines in a file



PureBytes Links

Trading Reference Links

Herman,

If you find that it works out for you in the simple case, you can add 
additional fields to the in memory record structure, parse your line 
of data into the separate fields, then use any of those fields as the 
field to sort on. You can then define a variable in AFL for which 
column you want to sort with and reference that variable within the 
vbscript.

Modifying the script given, it might look something like this:

// SortColumn declared in AFL as a String
SortColumn = "Symbol"; // Must match one of DataList.Fields

<%
...
Set DataList = CreateObject("ADOR.Recordset")
DataList.Fields.Append "Symbol", adVarChar, MaxCharacters
DataList.Fields.Append "Open", adVarChar, MaxCharacters
DataList.Fields.Append "High", adVarChar, MaxCharacters
...
DataList.Open
...
Do Until objFile.AtEndOfStream
strLine = Split(objFile.ReadLine, ",")
DataList.AddNew
DataList("Symbol") = strLine(0)
DataList("Open") = strLine(1)
DataList("High") = strLine(2)
...
DataList.Update
Loop
...
DataList.Sort = AFL("SortColumn")
...
%>

Again, I haven't actually tried any of this. But, it looks like it 
should work.

Mike








------------------------------------

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/