Page 1 of 1

Recording the current position selected in an Array

PostPosted: Tue May 12, 2015 3:41 pm
by PaulTomo
While testing the new list & combo boxes, I have created some arrays from an online database using PHP script and the form action.
I have then saved the result into either a list or combo box but wanted to be able to Record current position in an Array of the result selected so it is possible to step forwards or backwards from that point with a push button that increases or decreases the count.

If I start at the first item or the last item, I can get the information I need but If there are 350 items in the array and one is selected in the middle, say the 125th item, is there any way to save that position to a variable?

I'll probably work it out with a clear mind tomorrow but any help is appreciated.

Thanks Again

Re: Recording the current position selected in an Array

PostPosted: Wed May 13, 2015 2:06 pm
by Neosoft Support
The variable associated with the Listbox will contain the text/value of the selected item. You can then use the ArraySearch action to find the index of that item in the array. Keep in mind that the index of the first item in the array is zero. ArraySearch returns -1 if no match is found.