The listMax
function iterates through a list and finds the field with the greatest value.
2. How many children to you have?
type: radio
optsfrom: series[1..10]
3. Enter each child’s age in years.
instruct: If you are expecting a child or if they are under 1 year old, enter 0 for age.
type: integer table
range: 0-17
showrowtag: n
rowsfrom: series[1..10] {if [id]<=$Q2} {text: Child [id]}
setterm: Q3_TERM
condition: (listMax(series[1..10]; $Q3R[id])) < 10
text: Q3 | Age of oldest child is less than 10 years old
Tip! Not sure which list function is best suited for your needs? Review all list functions here.
Details
-
In its most basic form,
listMax
accepts two inputs: a list name and a field reference constructed with the '[id]' placeholder. - Options can be filtered in or out of the list with inclusion/exclusion syntax.
-
listMax
can be used with conditional statements such asshowif
andcondition
, as shown above, as well as withcvalue
. - When multiple lists or conditions are used, the list name is prefixed to the
[id]
reference and separated by a colon, (e.g.,[LISTNAME:id]
). Prefixing clarifies list references and is necessary for the software to iterate and sum calculations across different lists. - Though not explicitly tied to tables, table references are imagined to be the most common usage.
Additional examples
Finding the max value from multiple lists
In the next example, we use two lists in the listMax
function to calculate the answer for the cvalue
tag at QMAX. Both lists are derived from Q3's inline lists. Each list name is prefixed to the [id]
reference where the list will be iterated through (the rows and columns [id]
placeholders) and separated by a colon.
Comments
0 comments
Please sign in to leave a comment.