ELcollections map read can not handle duplicate keys

Questions about MultiCharts and user contributed studies.
bowlesj3
Posts: 2028
Joined: 21 Jul 2007
Has thanked: 174 times
Been thanked: 405 times

ELcollections map read can not handle duplicate keys

Postby bowlesj3 » 05 Jan 2009

I just found out that the read for the ELcollections mapXY command (For example: MapNS.ReadFile) can not read duplicate keys on a text file. It takes the second one and brings it into memory ignoring any duplicates before it. To get around this you have to add .1 .2 etc to the key to make them unique.

bowlesj3
Posts: 2028
Joined: 21 Jul 2007
Has thanked: 174 times
Been thanked: 405 times

Postby bowlesj3 » 05 Jan 2009

I just reread the documentation shown below on this command. There is no mention of this problem other than the word "Key" might suggest that it should be unique. However keys do not have to be unique in other languages. It would create a larger problem if you have duplicates in the MapSN.ReadFile command although I guess you could put .1 .2 etc on the string key using a concat command of some sort.



Value1 = MapNS.ReadFile(ID, FileName);
Reads a list of key-value pairs from a text file into the MapNS specified by ID. Each line of the file should contain a numeric key and a string value, separated by a comma:

30,Good
10,Bad
20,Indifferent


Return to “MultiCharts”