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

Forums for specific tips, techniques and example code
Jay
Posts: 25
Joined: Mon Jul 23, 2018 10:15 am

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

Postby Jay » Fri Oct 12, 2018 1:48 pm

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 .

JohnP
Posts: 73
Joined: Mon Sep 28, 2009 8:41 am
Location: Christchurch

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

Postby JohnP » Fri Oct 12, 2018 5:42 pm

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);

User avatar
ghosttie
Posts: 181
Joined: Sat Aug 15, 2009 1:25 am
Location: Atlanta, GA, USA
Contact:

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

Postby ghosttie » Fri Oct 12, 2018 11:57 pm

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?
I have a catapult. Give me all the money or I will fling an enormous rock at your head.


Return to “Tips and Techniques”

Who is online

Users browsing this forum: No registered users and 11 guests