v1.20.0+
Create text actionThe create text
action extends the action data syntax allowing these special replace options:
- $a(actionName) replaced with the value from the action data
- $#(startLoop) Start a loop for all rows of the
data
cube - $#(endLoop) End of the loop
- $c(columnName) Replaced with value of the defined
data column
inside the loop
One Action allows one loop only, but multiple actions could simply be added together with the action data
replacement.
Examples
Consider we have data with the columns Alpha
& Num
XML
='<xml>
<table>
$#(startLoop)
<row>
<Name>$c(Alpha)</Name>
<value>
<label>some fixed text</label>
<num>$c(Num)</num>
</value>
</row>
$#(endLoop)
</table>
</xml>'
<xml>
<table>
<row>
<Name>A</Name>
<value>
<label>some fixed text</label>
<num>1</num>
</value>
</row>
<row>
<Name>B</Name>
<value>
<label>some fixed text</label>
<num>2</num>
</value>
</row>
<row>
<Name>C</Name>
<value>
<label>some fixed text</label>
<num>3</num>
</value>
</row>
<row>
<Name>D</Name>
<value>
<label>some fixed text</label>
<num>4</num>
</value>
</row>
...
</table>
</xml>
JSON
For JSON array creation the Remove last character in loop
setting can be used to remove the comma after the last object.
='{
"someArray":[
$#(startLoop){
"name":"$c(Alpha)",
"num":"$c(Num)"
},$#(endLoop)
]
}'
{
"someArray":[
{
"name":"A",
"num":"1"
},{
"name":"B",
"num":"2"
},{
"name":"C",
"num":"3"
}...
]
}