Besides simple access, you can use the configuration to generate different versions of your workflow markup. For example, you could generate a markup using a loop on a multiple text input, or conditionally depending on a checkbox input.
Helper functions are often ideal for this purpose. The following sections describe which helpers are available and how they can be used.
Here is a list of keywords and their descriptions with a code example:
{#assign "myval"} This is a variable {/assign}
+
,-
,*
,/
, and %
).{math myNum "+" 5}
@index
and the current key name via @key
. You can also use @first
and @last to check whether you are at the first/last step of the iteration{#each myObj} {@index} {/each}
==
,>
,<
,>=
, and <=
can be used as operators. A hash parameter can be used to increment or decrement the counter.{#for 5 ">" 0 after="-2"} {this} {/for}
==
, !=
, <
, <=
, and equalsIgnoreCase
can be used as operators.{comapre myStr "==" "Hallo}
{#switch type} {#case "article"} This is an article {/case} {#case "resource"} This is a resource {/case}
isCar=false
and hasLicense=true
:{#if (or (and isCar hasPlate) (and (not isCar) hasLicense)))} Allowed to drive. {else} Not allowed to drive.
trueVar=true
:{unless trueVar} This is text {/unless}
TRUE
or FALSE
as output depending on the variables:{and isCar hasPlate}
TRUE
or FALSE
as output depending on the variables:{or isCar hasPlate}
TRUE
as output if isCar=false
:{not isCar}
size
, is_not_singleton
, and is_singleton
can be used as operators.{collection myColl "size"}
{#each bar} {lookup ../foo@index} {/each}
{#with myVal} {#ech myObj} {/each} {/with}
Here is a list of keywords and their descriptions with a code example:
"lowercase"
, "lowercase_underscore"
, or "lowercase_hyphen"
).{caseFormat myStr "lowercase_underscore"}
{capitalizeFirst value}
{cut value " "}
FALSE
. Otherwise, the original value is used.{defaultIfEmpty value "nothing"}
{join "a" "b" "c" " // " prefix="" suffix=""}
{center value size=19 pad=" "}
{ljust value 20 pad=" "}
{rjust value 20 pad=" "}
{substring value 3} {substring value 0 3}
{lower value}
{upper value}
{slugify value}
value="Hello %s"
and param1="TeamViewer"
:{stringFormat value param1}
{stripTags value}
{capitalize value fully=false}
{abbreviate value 6}
{wordWrap value 5}
{replace value "..." "rocks"}
TRUE
, FALSE
, and (optionally) NULL
to strings with values such as "yes", "no", or "maybe".{yesno value yes="yes" no="no" maybe="maybe"}
"full"
to show dates in a format such as "Tuesday, June 19, 2012""medium"
to show dates in a format such as "Jun 19, 2012""short"
to show dates in a format such as "6/19/12""pattern"
to show dates in a custom pattern.{dateFormat date ["format"] [format="format"] [tz=timeZone|timeZoneId]}
groupingUsed
to define whether or not grouping will be used in the formatmaximumFractionDigits
to define the maximum number of digits allowed in the fraction portionmaximumIntegerDigits
to define the maximum number of digits in the integer portionminimumFractionDigits
to define the minimum number of digits in the fraction portionminimumIntegerDigits
to define the minimum number of digits in the integer portionparseIntegerOnly
to define whether or not numbers should be parsed as only integersroundingMode
to define how numbers should be rounded the (in combination with UP
, DOWN
, CEILING
, FLOOR
, HALF_UP
, HALF_DOWN
, HALF_EVEN
, UNNECESSARY
){numberFormat number ["format"] [locale=default]}
Here's a practical example:
"General": { "use_camera": { "title": "Use Camera of Smartglasses", "inputType": "checkbox-input", "value": "true" } } } <onresume> <rule id="auto"> <expression>1</expression> <actions> §{#if General.use_camera.value}§ <action ref="start_cam"/> §{/if}§ </actions> </rule> </onresume>
As you can see, the if keyword here allows you to only execute an action when the corresponding configuration parameter is set to be true. It is important to note that all keywords are used inside the scope by first writing a hashtag (#).
Here is another example using the each keyword:
{ "Configuration": { "buttons": { "title": "Function Keys", "inputType": "multiple-dropdown-input", "elements": [ { "name": "TAB", "content": "ANDRRES_key_tab", "type": "TEXT", "translatable": true }, { "name": "DELETE", "content": "ANDRRES_key_delete", "type": "TEXT", "translatable": true }, { "name": "BACKSPACE", "content": "ANDRRES_key_backspace", "type": "TEXT", "translatable": true }, { "name": "F1", "content": "F1", "speech_cmd": "F 1", "type": "TEXT" }, { "name": "F2", "content": "F2", "speech_cmd": "F 2", "type": "TEXT" } ], "value": [ { "name": "TAB", "content": "ANDRRES_key_tab", "type": "TEXT", "translatable": true }, { "name": "DELETE", "content": "ANDRRES_key_delete", "type": "TEXT", "translatable": true } ] } } } <ui_update id="show_key_input_footer"> <widget_params> <ui_element name="FOOTER_L2"> <param name="VISIBILITY">INVISIBLE</param> </ui_element> <ui_element name="RETURN_L1"> <param name="menu_id" descriptor="">0</param> </ui_element> §{#each Configuration.buttons.value}§ <ui_element name="§{name}§"> <param name="menu_id" descriptor="">§{math @index "+" 1}§</param> </ui_element> §{#if @last}§ §{#if Configuration.enable_camera.value}§ <ui_element name="CAMERA"> <param name="MENU_ID">§{math @../index "+" 2}§</param> </ui_element> <ui_element name="ENTER"> <param name="MENU_ID">§{math @../index "+" 3}§</param> </ui_element> §{else}§ <ui_element name="ENTER"> <param name="MENU_ID">§{math @../index "+" 2}§</param> </ui_element> §{/if}§ §{/if}§ §{/each}§ </widget_params> </ui_update>
In this example, a multi-level drop-down menu is used to configure a number of buttons that are then shown on the user interface. For the last two buttons, there is a barcode scan depending on whether a checkbox input is set as well as another default button. Both buttons are shown rightmost in the interface. As you can see you here, can you can also create highly configurable components like this.