Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Added 6 new functions under "String Functions" B-15840

...

Anchor
Conditional Functions
Conditional Functions
Conditional Functions

...

(For Web Service output, see Functions#Web Web Service Functions.)
 

Note
titleNote

A prerequisite for the use of these functions is that Automatic Output Retrieval and Wait For Output are selected at task level, with the exception of the EXTENSION output type.

...

Note
titleNote

When using String functions that accept a String value parameter directly, you should be aware of expectations with respect to escape characters and escape sequences (see Functions#Escape Escape Sequences, below).


For String functions that accept a variable name parameter, the fully resolved value of the variable by the specified name will be used as the String value argument. The variable must be fully resolvable and must not contain an unresolved function.

...

Description

Returns a URL-encoded string according to the ASCII Encoding Reference for UTF-8; all non-alphanumeric characters are replaced with their equivalent hexadecimal escape sequences.

Syntax

${_varEncodeUrl('variableName')}

Parameters

  • variableName
    Required; Name of the variable whose value will be converted to a URL encoded string.
Example

Where Variable rawstring contains a value of “ABC$%^----DEF":

Panel

${_varEncodeUrl(‘rawstring’)} --> ABC%24%25%5E----DEF

...

Display Variables

...

Description

...

Task Instance Variable By XPath

Description

Resolves to the evaluated XPath expression applied to the value of the specified variable.

  • If the variable is unresolved, the function will remain unresolved.

  • If the variable is undefined, blank, or the path expression does not yield a result, the function will resolve to the default value.

Syntax

${_

scope

varXPath('variableName', 'xPathExpression'[, 'defaultValue', 'delimiter', prettyPrint])}

Parameters

(none)

Example

Panel

variableName
Required; The name of the variable to apply the XPath expression to.

xPathExpression
Required; XPath expression. https://www.w3schools.com/xml/xpath_intro.asp

defaultValue
Optional; Default value to return if the result is not found. Default is empty ('').

delimiter
Optional; If xPathExpression evaluates to multiple results, the delimiter to be used to separate those results. Default is new line character (\n).

prettyPrint
Optional; Specification (true or false) for whether or not XML will be pretty printed (indented). Default is false.

Example

my_variable=
<message>
  <code>10</code>
</message>

${_varXPath('my_variable', '//code/text()')}
> 10

Task Instance Variable By JsonPath

Description

Resolves to the evaluated JsonPath expression applied to the value of the specified variable.

  • If the variable is unresolved, the function will remain unresolved.

  • If the variable is undefined, blank, or the path expression does not yield a result, the function will resolve to the default value.

Syntax

${_varJsonPath('variableName', 'pathExpression'[, 'defaultValue', 'delimiter', prettyPrint])}

Parameters

variableName
Required; The name of the variable to apply the JsonPath expression to.

pathExpression
Required; JsonPath expression. https://github.com/json-path/JsonPath

defaultValue
Optional; Default value to return if the result is not found. Default is empty ('').

delimiter
Optional; If pathExpression evaluates to multiple results, the delimiter to be used to separate those results. Default is new line character (\n).

prettyPrint
Optional; Specification (true or false) for whether or not JSON will be pretty printed (indented). Default is false.

Example

my_variable=
{
  "code": 10
}

${_varJsonPath('my_variable', '$.code')}
> 10

Task Instance Variable By JsonPath As Array

Description

Resolves to the evaluated JsonPath expression applied to the value of the specified variable.

  • If the variable is unresolved, the function will remain unresolved.

  • If the variable is undefined, blank, or the path expression does not yield a result, the function will resolve to the default value.

Syntax

${_varJsonPathAsArray('variableName', 'pathExpression'[, 'defaultValue', prettyPrint])}

Parameters

variableName
Required; The name of the variable to apply the JsonPath expression to.

pathExpression
Required; JsonPath expression. https://github.com/json-path/JsonPath

defaultValue
Optional; Default value to return if the result is not found. Default is empty ('').

prettyPrint
Optional; Specification (true or false) for whether or not JSON will be pretty printed (indented). Default is false.

Example

my_variable=
[
  {
    "message" : "Hello",
    "code" : 10
  },
  {
    "message" : "World!",
    "code" : 20
  }
]

${_varJsonPathAsArray('my_variable', '$[*].message', '', true)}
>
[
    "Hello",
    "World!"
]

Task Instance Variable Number of Lines

Description

Resolves to the number of lines the value of the specified variable has.

  • If the variable is unresolved, the function will remain unresolved.

  • If the variable is undefined, or blank, the function will resolve to 0.

Syntax

${_varNumberOfLines('variableName')}

Parameters

variableName
Required; The name of the variable to return the number of lines for.

Example

my_variable=
Line 1
Line 2
Line 3

${_varNumberOfLines('my_variable')}
> 3

Task Instance Variable By Specific Line(s)

Description

Resolves to the specified line(s) of variable data for the specified variable.

  • If the variable is unresolved, the function will remain unresolved.

  • If the variable is undefined, blank, or no lines qualify, the function will resolve to the default value.

Syntax

${_varLines('variableName', startLine, numberOfLines[, 'defaultValue', 'resultDelimiter'])}

Parameters

variableName
Required; The name of the variable to apply the function to.

startLine


Required; Start line, where 1 is the first line and -1 is the last line.

numberOfLines
Required; Number of lines to return starting from the startLine.

defaultValue
Optional; Default value to return if no lines qualify. Default is empty ('').

resultDelimiter
Optional; Delimiter to use when concatenating matching lines. If not specified, "\n" or "\r\n" depending on original output line endings.

Example

my_variable=
Line 1
Line 2
Line 3
Line 4

${_varLines('my_variable', 2, 2)}
>
Line 2
Line 3

Task Instance Variable By Line(s) Matching Regular Expression

Description

Resolves to the line(s) of variable data that match the specified regular expression, of the specified variable.

  • If the variable is unresolved, the function will remain unresolved.

  • If the variable is undefined, blank, or no lines qualify, the function will resolve to the default value.

Syntax

${_varLinesByRegex('variableName', 'regexPattern'[, maxCount, numberOfLinesBefore, numberOfLinesAfter, 'defaultValue', 'resultDelimiter'])}

Parameters

variableName
Required; The name of the variable to apply the function to.

regexPattern
Required; Regular expression used for determining if a line matches. Regular expression must match the whole line (see Example, below).

maxCount
Optional; Maximum number of matching lines to return. Default is 1.

numberOfLinesBefore
Optional; Number of lines before each matching line to return along with the matching line. Default is 0.

numberOfLinesAfter
Optional; Number of lines after each matching line to return along with the matching line. Default is 0.

defaultValue
Optional; Default value to return if the result is not found. Default is empty ('').

resultDelimiter
Optional; Delimiter to use when concatenating matching lines. If not specified, "\n" or "\r\n" depending on original output line endings.

Example

my_variable=
Some_Text
ABC=Some_String
More_Text

${_varLinesByRegex('my_variable', '^ABC=')} /* Returns empty (the whole Line was not matched) */
>

${_varLinesByRegex('my_variable', '^ABC=.*')}
> ABC=Some_String

Anchor
System Functions
System Functions
System Functions

Display Variables

Description

Displays all the defined and built-in variables associated with the task instance.

Syntax

${_scope}

Parameters

(none)

Example

Panel

Generate Random Number

Description

Generates a random number between max (inclusive) and min (inclusive)

Syntax

${_random([max, min])}

Parameters

  • max
    Optional; Upper bound (inclusive) on the random number. Default is 9.
  • min
    Optional; Lower bound (inclusive) on the random number. Default is 0.

...

Description

Resolves the variable specified by the variable_name parameter and substitutes the default value if the variable cannot be resolved.

Syntax

${_resolveadv('variable_name', 'default_value', [use_default_if_blank])}

Parameters

  • variable_name
    Required; Variable name.
  • default_value
    Required; Default value to use if the variable cannot be resolved.
  • use_default_if_blank
    Optional; Specification (true or false) for whether or not to use the default value if the variable is empty or blank. (If use_default_if_blank is false, _resolveadv behaves like Functions# _resolve.)

Anchor
Universal Task Functions
Universal Task Functions
Universal Task Functions

...