In any text input that supports Inserting reference fields, an inline function can be entered that will be resolved at workflow run-time.
A number of functions are provided out of the box, and additional functions can be added with the NWAdmin.exe tool.
Functions can also be used as arguments for other functions.
Example:
Function behavior
The parsing engine first replaces any inserted reference tokens, and then the resulting text is evaluated for functions.
If a function contains another function as an argument, the inner most function will be evaluated first.
As reference tokens are replaced first, the reference token can also contain function syntax that will be evaluated.
If text used for a function argument contains function syntax (i.e. a brace or comma character) wrap the argument with {TextStart} and {TextEnd} to indicate a block of text that should not be parsed further.
Function reference
fn-Abs
Returns the absolute value of a number.
Example
fn-Abs({WorkflowVariable:Number})
Arguments
- Number The number to return the absolute value of.
fn-Currency
Represents a numeric value as a currency formatted text.
Example
fn-Currency({WorkflowVariable:Cost})
Arguments
- Number A variable containing a numeric value.
fn-DateDiffDays
Determines the number of days between two dates. The result can be a decimal value including partial days.
Example
fn-DateDiffDays({WorkflowVariable:StartDate}, {WorkflowVariable:EndDate})
Arguments
- Start date The starting date and time to calculate the difference between.
- End date The end date and time to calculate the difference between.
fn-DateDiffHours
Determines the number of hours between two dates. The result can be a decimal value including partial hours.
Example
fn-DateDiffHours({WorkflowVariable:StartDate}, {WorkflowVariable:EndDate})
Arguments
- Start date The starting date and time to calculate the difference between.
- End date The end and time date to calculate the difference between.
fn-DateDiffMinutes
Determines the number of minutes between two dates. The result can be a decimal value including partial minutes.
Example
fn-DateDiffMinutes({WorkflowVariable:StartDate}, {WorkflowVariable:EndDate})
Arguments
- Start date The starting date and time to calculate the difference between.
- End date The end and time date to calculate the difference between.
fn-DateDiffSeconds
Determines the number of seconds between two dates. The result can be a decimal value including partial seconds.
Example
fn-DateDiffSeconds({WorkflowVariable:StartDate}, {WorkflowVariable:EndDate})
Arguments
- Start date The starting date and time to calculate the difference between.
- End date The end and time date to calculate the difference between.
fn-FormatDate
Represents a date time value in text of a specific format.
Example
fn-FormatDate({WorkflowVariable:MyDate}, d)
Arguments
- Date A variable containing a date value.
- Format string Text describing how the date time value should be formatted. Information on how to format the value can be found on this page: Standard Date and Time Format Strings and this page Custom Date and Time Format Strings.
fn-Insert
Adds text in to a larger string.
Example
fn-Insert({WorkflowVariable:Text}, 4, {ItemProperty:Title})
Arguments
- Text The text to modify.
- Start position The character position to insert the new text at. The first character in the string is at position 0.
- New text The additional text that will be added at the start position.
fn-Length
Returns the number of characters in a string.
Example
fn-Length({WorkflowVariable:Text})
Arguments
- Text The string to count the characters of.
fn-Max
Returns the greater of two numbers.
Example
fn-Max({WorkflowVariable:Number1}, {WorkflowVariable:Number2})
Arguments
- Number 1 The first number to compare.
- Number 2 The second number to compare.
fn-Min
Returns the lesser of two numbers.
Example
fn-Min({WorkflowVariable:Number1}, {WorkflowVariable:Number2})
Arguments
- Number 1 The first number to compare.
- Number 2 The second number to compare.
fn-NewGuid
Generate a globally unique identifier.
Example
fn-NewGuid()
fn-PadLeft
Returns the provided string right aligned and padded to the total length with a specific character.
Example
fn-PadLeft({WorkflowVariable:Text}, 6)
fn-PadLeft({WorkflowVariable:Text}, 6,-)
Arguments
- Text The string to pad.
- Length The target total length of the padded result.
- Character Optional. The character to pad the original string with. A space character is used by default.
fn-PadRight
Returns the provided string left aligned and padded to the total length with a specific character.
Example
fn-PadRight({WorkflowVariable:Text}, 6)
fn-PadRight({WorkflowVariable:Text}, 6,-)
Arguments
- Text The string to pad.
- Length The target total length of the padded result.
- Character Optional. The character to pad the original string with. A space character is used by default.
fn-Power
Raises a number to the specified power.
Example
fn-Power({WorkflowVariable:Number}, {WorkflowVariable:Power})
Arguments
- Number The number to raise to the power.
- Number The power to raise number to.
fn-Remove
Removes a section of text in a larger string.
Example
fn-Remove({WorkflowVariable:Text},0,3)
Arguments
- Text The text to modify.
- Start position The character position from which to remove the following characters. The first character in the string is at position 0.
- Length Optional. The number of characters from the start position to remove. All remaining characters will be removed by default.
fn-Replace
Replaces a section of text in a larger string.
Example
fn-Replace({WorkflowVariable:Text},abc,{ItemProperty:Title})
Arguments
- Text The text to modify.
- Old value The text to search for and replace.
- New value The text to replace Old value with.
fn-Round
Rounds a decimal value to the nearest integer.
Example
fn-Round({WorkflowVariable:Number})
Arguments
- Number The decimal number to round.
fn-SubString
Extracts a portion of text from a string.
Example
fn-SubString({WorkflowVariable:Text},5,10)
Arguments
- Text The text to extract a value from
- Start index The position in the text of the first character to retrieve. The first character in the string is at position 0.
- Number of characters The number of characters to retrieve from the start index.
fn-ToLower
Formats text in a string to all lower case.
Example
fn-ToLower({WorkflowVariable:Text})
Arguments
- Text The string to convert to all lower case.
fn-ToTitleCase
Formats text in a string to title case.
Example
fn-ToTitleCase({WorkflowVariable:Text})
Arguments
- Text The string to convert to title case.
fn-ToUpper
Formats text in a string to all upper case.
Example
fn-ToUpper({WorkflowVariable:Text})
Arguments
- Text The string to convert to all upper case.
fn-Trim
Removes leading and trailing whitespace from a string.
Example
fn-Trim({WorkflowVariable:Text})
Arguments
- Text The text to remove leading and trailing whitespace characters from.
fn-XmlEncode
Encodes a string to make it safe for viewing in html.
Example
fn-XmlEncode({WorkflowVariable:Text})
Arguments
- Text The text to encode.
fn-XmlDecode
Decodes a html safe string to regular text.
Example
fn-XmlDecode({WorkflowVariable:Text})
Arguments
- Text The text to decode.