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.

General helpers

Here is a list of keywords and their descriptions with a code example:

  • assign
    • Description: Allows you to assign a variable.
    • Code example with a myVal variable in context with the corresponding value as output:
{#assign "myval"}
This is a variable
{/assign} 
  • math
    • Description: Allows you to perform simple arithmetic operations (in combination with +,-,*,/, and %).
    • Code example:
{math myNum "+" 5}
  • each
    • Description: You can access the current loop index via @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
    • Code example with a value such as "0 1 2 3 4" as output:
{#each myObj}
{@index}
{/each}
  • for
    • Description: Lets you create a for loop that allows a simple repetition. ==,>,<,>=, and <= can be used as operators. A hash parameter can be used to increment or decrement the counter.
    • Code example:
{#for 5 ">" 0 after="-2"}
{this}
{/for}
  • compare
    • Description: Allows you to compare two values. ==, !=, <, <=, and equalsIgnoreCase can be used as operators.
    • Code example to provide TRUE as output if the myStr variable is "Hello":
{comapre myStr "==" "Hallo}
  • switch, case
    • Description: Allows you to create a switch/case construct.
    • Code example to return "This is an article." as output if the type is "article":
{#switch type}
{#case "article"}
This is an article
{/case}
{#case "resource"}
This is a resource
{/case}
  • if
    • Description: Allows you to insert a text block if a condition is met.
    • Code example to provide "Allowed to drive" as output if the Boolean variables isCar=false and hasLicense=true:
{#if (or (and isCar hasPlate) (and (not isCar) hasLicense)))}
Allowed to drive.
{else}
Not allowed to drive.
  • unless
    • Description: Allows you to insert a text block if an inverse condition is met.
    • Code example to provide "This is text" as output if trueVar=true:
{unless trueVar}
This is text
{/unless}
  • and
    • Description: Acts as the logical AND for multiple Boolean values.
    • Code example to return TRUE or FALSE as output depending on the variables:
{and isCar hasPlate}
  • or
    • Description: Acts as the logical OR for multiple Boolean values.
    • Code example to return TRUE or FALSE as output depending on the variables:
    • Code example:
{or isCar hasPlate}
  • not
    • Description: Acts as the logical NOT for multiple Boolean values.
    • Code example to return TRUE as output if isCar=false:
{not isCar}
  • collection
    • Description: Allows you to return the size or singleton property of a collection. size, is_not_singleton, and is_singleton can be used as operators.
    • Code example to return the size (e.g., "4") as output:
{collection myColl "size"}
  • lookup
    • Description: Allows for dynamic parameter resolution using variables to, for example, resolve values for array indexes.
    • Code example:
{#each bar}
{lookup ../foo@index}
{/each}
  • with
    • Description: Can be used to pass a parameter on to a helper.
    • Code example:
{#with myVal}
{#ech myObj}
{/each}
{/with}

String helpers

Here is a list of keywords and their descriptions with a code example:

  • caseformat
    • Description: Allows you to apply a specific format to strings ("lowercase", "lowercase_underscore", or "lowercase_hyphen").
    • Code example to reformat a string such as "This is a string" as "this_is_a_string":
{caseFormat myStr "lowercase_underscore"}
  • capitalizeFirst
    • Description: Allows you to capitalize the first letter of a string.
    • Code example to reformat a string such as "teamViewer" as "TeamViewer":
{capitalizeFirst value}
  • cut
    • Description: Allows you to remove all values of an argument from a given string
    • Code example to reformat a string such as "String with spaces" as "Stringwithspaces":
{cut value " "}
  • defaultIfEmpty
    • Description: Allows you to define an alternative value to be used if an evaluation returns FALSE. Otherwise, the original value is used.
    • Code example to provide "nothing" as output if the value variable is empty:
{defaultIfEmpty value "nothing"}
  • join
    • Description: Allows you to join an array with an iterator or iterable with a string
    • Code example to provide "a // b // c" as output for an array only containing the values "a", "b", and "c":
{join "a" "b" "c" " // " prefix="" suffix=""}
  • center
    • Description: Allows you to center-align the value in a field of a given width.
    • Code example:
{center value size=19 pad=" "}
  • ljust
    • Description: Allows you to left-align the value in a field of a given width.
    • Code example:
{ljust value 20 pad=" "}
  • rjust
    • Description: Allows you to right-align the value in a field of a given width.
    • Code example:
{rjust value 20 pad=" "}
  • substring
    • Description: Allows you to divide a string into substrings.
    • Code example to provide "Viewer" and, respectively, "Team" as output after processing a string with "TeamViewer" as original value:
{substring value 3}
{substring value 0 3}
  • lower
    • Description: Allows you to convert a string into all lowercase text.
    • Code example to reformat a string such as "TeamViewer" as "teamviewer":
{lower value}
  • upper
    • Description: Allows you to convert a string into all uppercase text.
    • Code example to reformat a string such as "Hello" as "HELLO":
{upper value}
  • slugify
    • Description: Allows you to convert a string into all lowercase text and simultaneously remove any non-word characters (alphanumeric and underscores) as well as convert spaces into hyphens. Furthermore, any trailing whitespace are trimmed.
    • Code example to reformat a string such as "TeamViewer is great" as "teamviewer-is-great":
{slugify value}
  • stringFormat
    • Description: Allows you to format a variable according to a particular argument (acts as a string formatting specifier).
    • Code example to provide "Hello TeamViewer" as output if value="Hello %s" and param1="TeamViewer":
{stringFormat value param1}
  • stringTags
    • Description: Allows you to remove all HTML and XHTML tags.
    • Code example:
{stripTags value}
  • capitalize
    • Description: Allows you to capitalize all words in a string that are separated by whitespaces.
    • Code example to reformat a string such as "my first post" as "My First Post":
{capitalize value fully=false}
  • abbreviate
    • Description: Allows you to truncate a string if it is longer than the specified number of characters. Truncated strings will end with a translatable ellipsis charater ("…")
    • Code example to reformat a string such as "TeamViewer is great" as "TeamVi…":
{abbreviate value 6}
  • wordWrap
    • Description: Allows you to wrap words at specified line length.
    • Code example to reformat a string such as "My words are long" as "My\r\nwords\r\n are\r\n long":
{wordWrap value 5}
  • replace
    • Description: Allows you to replace each occurrence of a particular substring of a string that matches the literal target sequence with the specified literal replacement sequence.
    • Code example to reformat a string such as "Handlebars ..." as "Handlebars rocks":
{replace value "..." "rocks"}
  • yesno
    • Description: Allows you to map values for TRUE, FALSE, and (optionally) NULL to strings with values such as "yes", "no", or "maybe".
    • Code example:
{yesno value yes="yes" no="no" maybe="maybe"}
  • dateformat
    • Description: Allows you to apply a particular format for dates. The format option can be specified as parameter or hash (i.e., names parameter). You can use the follwoing options:
      • "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.
    • Code example:
{dateFormat date ["format"]
[format="format"]
[tz=timeZone|timeZoneId]}
  • numberFormat
    • Description: Allows you to use one of the following formatting parameters: "integer", "currency", "percent", and "pattern"]. Other available options are:
      • groupingUsed to define whether or not grouping will be used in the format
      • maximumFractionDigits to define the maximum number of digits allowed in the fraction portion
      • maximumIntegerDigits to define the maximum number of digits in the integer portion
      • minimumFractionDigits to define the minimum number of digits in the fraction portion
      • minimumIntegerDigits to define the minimum number of digits in the integer portion
      • parseIntegerOnly to define whether or not numbers should be parsed as only integers
      • roundingMode to define how numbers should be rounded the (in combination with UP, DOWN, CEILING, FLOOR, HALF_UP, HALF_DOWN, HALF_EVEN, UNNECESSARY)
    • Code example:
{numberFormat number ["format"] [locale=default]}

Examples

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.