The listMax
function iterates over a list and evaluates a statement for each list iteration. listMax
returns the result of the statement which evaluated to the largest value. Though not explicitly tied to tables, table references are imagined to be the most common usage.
Tip! Not sure which list function is best suited for your needs? Review all list functions here.
Syntax
In its most basic form, listMax
accepts two inputs: a list name with optional inclusion/exclusions, and a logical condition with an iterator.
Basic
The syntax examples below use listMax
to return the result of the statement which evaluated to the largest value, and show how to use listMax
to include or exclude options.
#Basic format listMax(LISTNAME; Logical statement with [id]) #Inclusion syntax to limit options from list listMax(LISTNAME [List IDs to include]; Logical statement with [id]) #Exclusion syntax to limit options from list listMax(LISTNAME -[List IDs to exclude]; Logical statement with [id])
Advanced
There are a few scenarios with list functions which require the Survey Programmer (SP) to explicitly state the list name along with the element [id]
reference to help the system differentiate the list data. In these instances, the list name is prefixed to the [id]
reference, separated by a colon. As with the regular element [id]
reference, we also wrap this construction in square braces, e.g., '[LISTNAME:id]', to pull the option data through.
One common instance where this occurs is any time two or more lists are invoked in the list function, e.g.,'listMax(LIST1, LIST2; ...)'. This often happens in a hidden variable using cvalue
. Here, all list names will be prefixed to their list 'id' reference. See the section Largest value in a pulldown table below for more information.
#Using two different lists, allowing the logical condition to contain two axes of data, prefixing the list name to the iterator for each.
listMax(LISTA, LISTB; Logical statement and field reference with [LISTA:id] [LISTB:id] iterators)
Examples
Question conditioning
Largest value in a pulldown table
Comments
0 comments
Please sign in to leave a comment.