Tech Tip: Is the Element Zero Sorted in Arrays?
PRODUCT: 4D | VERSION: 6.5 | PLATFORM: Mac & Win
Published On: April 6, 2001
The element zero in an array is not sorted when you use the command SORT ARRAY. Here is an example to illustrate that:
After you execute SORT ARRAY(aLetter;>), the array contents become:
aLetter{0}="Z"
aLetter{1}="A"
aLetter{2}="B"
aLetter{3}="C"
aLetter{4}="D"
aLetter{5}="E"
After you execute SORT ARRAY(aLetter;<), the array contents become:
aLetter{0}="Z"
aLetter{1}="E"
aLetter{2}="D"
aLetter{3}="C"
aLetter{4}="B"
aLetter{5}="A"
To copy the code described above, select the text below:
Case of
: (Form event=On Load )
ARRAY STRING(10;aLetter;5)
aLetter{0}="Z"
aLetter{1}="A"
aLetter{2}="B"
aLetter{3}="C"
aLetter{4}="D"
aLetter{5}="E"
End case