Page 1 of 1

how to sort table or dictionary as I can put the object to the last row of the table

Posted: Fri Oct 12, 2018 1:48 pm
by Jay
Let's I have a few columns and the first column shows only the number..
What I want to do with the table is that if I add a new object to the table, it is organized by ID as I set the keyID ascending order from the dictionary and the table is getting the data from the dictionary.
the problem lies here.. I set the ID as r1, r2 ,r3 etc. This way the dictionary sort the data like r1, r10, r11, r12, r2, r3..
How I sort the Dictionary as ascending numeric ascending order so I can arrange the table well.
Thank you .

Re: how to sort table or dictionary as I can put the object to the last row of the table

Posted: Fri Oct 12, 2018 5:42 pm
by JohnP
Normally for an id I would use fixed length numbers with leading zeros, then it sorts correctly. Integer::padLeadingWith does that for you. For example, try this:

write "r" & 14.padLeadingWith("0", 6);

Re: how to sort table or dictionary as I can put the object to the last row of the table

Posted: Fri Oct 12, 2018 11:57 pm
by ghosttie
Can you use a numeric ID? Does it need to have an "r" in front of it? Does it need to have an "r" in front of it in the database or could you just add that when displaying it?