[BUG] 'combine' problems
Jim Ault
jimaultwins at yahoo.com
Sat Jan 30 12:19:39 EST 2010
By mis-ordered, do mean the sequence of rows has changed,
or the keys are matched with different values?
The result should be that the row order has changed.
arr[mary] lamb
arr[prince] charming
arr[frog] kiss
Associative arrays don't have the order based on anything but the
content of the keys. There is no 'numerical order'
If this is important then you could do the following with the values
put "mary^1^lamb" into textLines
put cr & "prince^2^charming" after textLines
put cr & "frog^3^kiss" after textLines
split textLines using cr and "^"
textLines[mary] 1^lamb
textLines[prince] 2^charming
textLines[frog] 3^kiss
combine textLines using cr and "^"
set the itemDel to "^"
sort textLines by item 2 of each
mary^1^lamb
prince^2^charming
frog^3^kiss
Of course you could put the line number at the end of each value as
well.
Jim Ault
Las Vegas
On Jan 30, 2010, at 4:10 AM, Hugh Senior wrote:
>
> http://quality.runrev.com/qacenter/show_bug.cgi?id=8582
>
> split tValues by row, then
> combine tValues by row
>
> The above should re-instate the original data, BUT...
>
> When combining values that have been split by row, the keys are
> combined
> alphabetically not numerically. This results in the data becoming
> mis-ordered.
>
> Tip: Do not rely on split/combine to reproduce your original data!
>
More information about the use-livecode
mailing list