General information
Category:
Coding, syntax & commands
>I can't seem to get my brain around this one today, so I was hoping to borrow the group brains for a while. :)
>
>I have an array: laOrder[6]. Each element contains a number 1-6. But I only want each number used once. I start with this:
>
>laOrder[1] = 1
>laOrder[2] = 2
>laOrder[3] = 3
>laOrder[4] = 4
>laOrder[5] = 5
>laOrder[6] = 6
>
>If I do this:
>
>laOrder[3] = 1
>
>I want the rest to renumber themselves, but keep the same order:
>
>laOrder[1] = 5
>laOrder[2] = 6
>laOrder[3] = 1
>laOrder[4] = 2
>laOrder[5] = 3
>laOrder[6] = 4
>
>Is there a simple way to do this? It seems like it shouldn't be hard, but my brain is acting like it does when I think about recursion. LOL!
>
>Thanks,
>
>Michelle
I don't know what you actually want with this, but you can loop through the array to change them.
We have something alike in our app.
Then we only have even numbers.
when the users changes one (to a not even value), the whole table is resorted and the numbers are then replaced with 2,4,6 etc.
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only