nextvalue
nextvalue
ITEM
,
VALUES
,
SEPARATOR

The nextvalue statement advances a variable or field to the next value in a list.

Parameters

This statement has three parameters:

item – the variable or field to be modified.

values – the list of values to cycle through. If this parameter is omitted the variable or field will be assumed to be a boolean true/false choice.

separator – the separator used for the value list. If this parameter is omitted the statement will automatically determine the separator (see below).

Description

This statement will cycle the value of an item through a list of values. In this example, the color will advance to the next color each time the nextvalue statement is invoked, cycling back to the first color when the end of the list is reached.

    let colors = "red,blue,green,yellow,pink"
    let color = "green"
    nextvalue color,colors,","
    message color ☞ yellow
    nextvalue color,colors,","
    message color ☞ pink
    nextvalue color,colors,","
    message color ☞ red

If the separator parameter is omitted the statement will attempt to automatically determine the separator by looking at the list. It will check for the presence of carriage returns, line feeds, tabs, semicolons, slashes, commas or spaces, and if found, use that character as the separator. In this example Panorama automatically determines that the separator character is a comma.

    let colors = "red,blue,green,yellow,pink"
    let color = "green"
    nextvalue color,colors
    message color ☞ yellow
    nextvalue color,colors
    message color ☞ pink
    nextvalue color,colors
    message color ☞ red

If only a single parameter is passed, the value list defaults to the boolean values true() and false(), so the value will toggle on and off with each invocation. If the variable/field does not currently contain either true or false it is set to true as default.

    let arrived = false()
    nextvalue arrived
    message boolstr(nextvalue) ☞ TRUE
    nextvalue arrived
    message boolstr(nextvalue) ☞ FALSE

If the variable/field is empty or contains a value not in the accepted list of values it will be set to the first value in the list as default.

    let colors = "red,blue,green,yellow,pink"
    let color = "brown"
    nextvalue color,colors,","
    message color ☞ red

See Also

- arraydeduplicate -- removes duplicate elements from an array (see Text Arrays).
- arrayintegersort -- sorts all the numeric elements of a text array in proper numeric order.
- arraynumericsort -- sorts all the numeric elements of a text array in proper numeric order.
- batchreplace( -- performs multiple find/replace operations on a piece of text.
- listchoices( -- builds a text array containing a list of all the values stored in a specified field.
- lookupall( -- builds a text array containing one item for every record in the target database where the data in the keyField matches the keyData. Each item in the text array contains the value extracted from the dataField for that record. If the data field is a numeric or date field, it is converted to text using the default patterns for that field.
- lookupalldouble( -- is similar to the lookupall( function, but it returns two fields from the target database instead of just one.
- lookupalloctet( -- is similar to the lookupall( function, but it returns eight fields from the target database instead of just one.
- lookupallquadruple( -- is similar to the lookupall( function, but it returns four fields from the target database instead of just one.
- lookupallquintuplet( -- is similar to the lookupall( function, but it returns five fields from the target database instead of just one.
- lookupallseptuplet( -- is similar to the lookupall( function, but it returns seven fields from the target database instead of just one.
- lookupallsextet( -- is similar to the lookupall( function, but it returns six fields from the target database instead of just one.
- lookupalltriple( -- is similar to the lookupall( function, but it returns three fields from the target database instead of just one.

History

Version | Status | Notes
10.2 | New | New in this version.