<setv>

<setv> is a special operation that allows for user-defined variables and for setting their values. Values may be constant or defined by a 1010data Macro Language query; however, all values set must be scalar.

Description

The name attribute in <setv> allows the name to be set using programmatic logic. Therefore, <setv>, rather than <set> is used in situations where one variable's name is determined by another variable.

Syntax

<setv name="[ARBITRARY_VARIABLE]" value="[ARBITRARY_VALUE]"/>

Attributes

name
The name attribute accepts the arbitrary name of a variable.
value
The value attribute accepts the value of the variable created by the value of the name attribute.

Example

In the following example, <setv> uses a <for> loop to create three new variables with names determined by another variable.

<base table="default.lonely"/>
<for i="1" to="3">
  <setv name="variable{@i}" value="value#{@i}"/>
</for>
<for i="1" to="3">
  <willbe name="column{@i}" value="'{@variable{@i}}'"/>
</for>