$previous list item
From UBot Studio
(Difference between revisions)
Line 1: | Line 1: | ||
$previous list item is a [[Data Functions|Data Function]]. | $previous list item is a [[Data Functions|Data Function]]. | ||
The function returns the list item at the list's current position and decrements the list's position. | The function returns the list item at the list's current position and decrements the list's position. | ||
+ | |||
This function works exactly the same as $next list position except you would work | This function works exactly the same as $next list position except you would work | ||
from the end of a list and work up it. | from the end of a list and work up it. | ||
+ | |||
So instead of looping through a list from position 0 to position 9, you loop through it | So instead of looping through a list from position 0 to position 9, you loop through it | ||
from position 9 to position 0. | from position 9 to position 0. |
Revision as of 18:26, 14 April 2013
$previous list item is a Data Function. The function returns the list item at the list's current position and decrements the list's position.
This function works exactly the same as $next list position except you would work from the end of a list and work up it.
So instead of looping through a list from position 0 to position 9, you loop through it from position 9 to position 0.
Example
add list to list(%my list, $list from text("list item 1, list item 2,list item 3, list item 4,list item 5,list item 6", ","), "Delete", "Global") set list position(%my list, 3) loop(2) { alert($previous list item(%my list)) }
Setting the list position to 3 informs the list to start from list position 3 and decrements by two list position. The loop set to 2 will allow the previous list function to only decrement by two list positions.
Additional Information
The list positions are 0 based. If you have 6 items in a list, the 0 based list will number the list items from 0-5, not 1-6.