The listProduct
function iterates over a list and evaluates a statement for each list iteration. listProduct
returns the product of the evaluated statements. 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, listProduct
accepts two inputs: a list name with optional inclusion/exclusions, and a logical condition with an iterator.
Basic syntax
The syntax examples below use listProduct
to return the product of the evaluated statements, and show how to use listProduct
to include or exclude options.
#Basic format listProduct(LISTNAME; Logical statement with [id]) #Inclusion syntax to limit options from list listProduct(LISTNAME [List IDs to include]; Logical statement with [id]) #Exclusion syntax to limit options from list listProduct(LISTNAME -[List IDs to exclude]; Logical statement with [id])
Advanced syntax
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.,'listProduct(LIST1, LIST2; ...)'. This often happens in a hidden variable using cvalue
. Here, all list names will be prefixed to their list 'id' reference.
#Using two different lists, allowing the logical condition to contain two axes of data, prefixing the list name to the iterator for each.
listProduct(LISTA, LISTB; Logical statement and field reference with [LISTA:id] [LISTB:id] iterators)
Examples
Product of table
Comments
0 comments
Please sign in to leave a comment.