EL Collections writing to a file in order

Questions about MultiCharts and user contributed studies.
jpartner
Posts: 12
Joined: 22 Sep 2013
Has thanked: 4 times

EL Collections writing to a file in order

Postby jpartner » 03 May 2024

Good day. I have beat this to death and its time to ask for some help. I have been successful in getting data into .csv file using EL Collections but not in the order it should be written. It appears to me to be writing the file in Alphabetical Order - which is what I cannot seem to stop from happening.
Here is the source code:

for x = 100 downto 0
begin
ListID =ListN.New;
for y = 100 downto 0
begin
grid_value = strtonum(incoming_array[x,y]);
Value1 = Listn.pushback(ListID, Grid_value);
end; //y

Value1 = MapSC.Put(MapID, "X" + numtostr(x,0), listid); // add list to map

end; //x
Value1 = MapSC.SetColumnOrder(mapid, ColumnHeadings);
Value1 = MapSC.WriteFile(Mapid, Filename);

The output looks like this where it appears to be written to the file Alphabetically.
X0 X1 X10 X100 X11 X12 X13 X14 X15 X16 X17 X18 X19 X2 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X3 X30

What am I missing? Thank you!

faraz
Posts: 148
Joined: 25 Feb 2011
Has thanked: 26 times
Been thanked: 58 times

Re: EL Collections writing to a file in order

Postby faraz » 04 May 2024

MC should consider adding few functions to communicate through 3rd party applications for user friendly coding.

I request all to vote for this feature "Read from file" function addition in MC
https://www.multicharts.com/pm/public/m ... es/MC-2341

Thanks

User avatar
ABC
Posts: 723
Joined: 16 Dec 2006
Location: www.abctradinggroup.com
Has thanked: 125 times
Been thanked: 410 times
Contact:

Re: EL Collections writing to a file in order

Postby ABC » 06 May 2024

jpartner,

this is expected behavior since maps do not necessarily keep the order in which you added the values. Since you are using MapSC the keys are sorted in alphabetical order.

Since it is not clear from your code why you are using the approach you choose it it is difficult to suggest a workaround.

Regards,

ABC

jpartner
Posts: 12
Joined: 22 Sep 2013
Has thanked: 4 times

Re: EL Collections writing to a file in order

Postby jpartner » 06 May 2024

Thanks ABC. I was hoping there was a simple solution. Guess not. I was able to find a work around but it seems to me like it shouldn't have been necessary.

Thanks again


Return to “MultiCharts”