×
Menu
Index

Text variables

Text Variable
Description
%TODAY%
Current system date
%TIME%
Current system time
%YEAR%
Current year number (format:yyyy)
%MONTH%
Current month number (format:mm)
%DAY%
Current day number (format:dd)
%COMPANYNAME%
Current Company name
%TABLECAPTION%
Table caption of a given record
%FIELD?%
Field value from a table.
Example:
%FIELD1% returns the value of field 1 in a given table. If this variable is used in conjunction with record mapping to a different table, the program retrieves the value from the field in the associated table.
%CPTFIELD?%
Field caption from table.
Example:
%CPTFIELD1% returns the field caption from field 1 in a given table. If this variable is used in conjunction with record mapping to a different table, the program retrieves the caption from the field in the associated table.
%NO=NOSERIES%
Number from No. Series.
Example:
%NO=TO-DO% return next number in the "TO-DO" No. Series. The No. Series is modified due to this process. Multiple calls return different numbers for each call.
%SPRECORDID%
Record ID in SharePoint list.
%ATTACHUSERID%
The User ID who attached the document.
%ATTACHUSERLOGIN%
The user login from NavSherpa Users of the user who attached the document.
%USERID%
Current User ID.
%USERLOGIN%
User login from NavSherpa Users for the current user.
%TODAY-D?%
Current system date minus x days.
Example:
%TODAY-D1% returns the system date - 1 day
%TODAY-M?%
Current system date minus x months.
Example:
%TODAY-M1% retuens the system date - 1 month
%TODAY-Y?%
Current system date minus x years.
Example:
%TODAY-Y1% returns the system date - 1 year
%TODAY-W?%
Current system date minus x weeks.
Example:
%TODAY-W1% returns the system date - 1 week
%TODAY+D?%
Current system date plus x days.
Example:
%TODAY+D1% returns the system date + 1 day
%TODAY+M?%
Current system date plus x months.
Example:
%TODAY+M1% returns the system date + 1 month
%TODAY+Y?%
Current system date plus x years.
Example:
%TODAY+Y1% returns the system date + 1 year
%TODAY+W?%
Current system date plus x weeks.
Example:%TODAY+W1% returns the system date + 1 week
%SUM(?)%
Text function to create a sum.
Example:
%SUM(3;4)%
%SUM(%FIELD2%;%FIELD3%)%
%SUM(%MUL(3;4)%;%FIELD3%)%)
%DIF(?)%
Text function that shows the differences between two values.
Example:
%DIF(3;4)%
%DIF(%FIELD2%;%FIELD3%)%
%DIF(%MUL(3;4)%;%FIELD3%)%)
%MUL(?)%
Text function to invoke multiplication.
Example:
%MUL(3;4)%
%MUL(%FIELD2%;%FIELD3%)%
%MUL(%DIF(3;4)%;%FIELD3%)%)
%DIV(?)%
Text function to invoke division.
Example:
%DIV(3;4)%
%DIV(%FIELD2%;%FIELD3%)%
%DIV(%MUL(3;4)%;%FIELD3%)%)
%FORMAT(?;?;?)%
Accepts a locally formatted common data type in the first parameter, the name of the data type in the second parameter, and a format string that defines how the value should be formatted in the third parameter.
ie %FORMAT(<Value as Text>;<Data Type>;<Format String>)%
 
Data types currently supported are OPTION, ENUM, DATE, TIME, DATETIME, DECIMAL, INTEGER, BOOLEAN, CODE, TEXT and DURATION
 
A definition of the segments available for the Format String are available here:
https://docs.microsoft.com/en-us/dynamics-nav/format-property#standard-formats
 
Example:
Common regional format:
%FORMAT(-123456;INTEGER;<Sign><Integer Thousand>)% returns "-123,456"
%FORMAT(-123456.78;DECIMAL;<Sign><Integer Thousand><Decimals>)% returns "-123,456.78"
%FORMAT(-123456.78;DECIMAL;Debit <Integer><Decimals>)% returns "Debit 123456.78"
%FORMAT(42;INTEGER;[<Sign><Integer>])% returns "[42]"
%FORMAT(True;BOOLEAN;<Text>)% returns "Yes", depending on local language settings
%FORMAT(True;BOOLEAN;<Number>)% returns "1"
%FORMAT(0;BOOLEAN;<Text>)% returns "No", depending on local language settings
%YEAR(?)%
Accepts a locally formatted date and returns that date's year an integer.
Example:
For common date format: %YEAR(20/9/1984)% returns 1984
For American date format: %YEAR(9/20/1984)% returns 1984
For XML date format: %YEAR(1984-09-20)% returns 1984
%MONTH(?)%
Accepts a locally formatted date and returns that date's month an integer.
Example:
For common date format: %MONTH(20/9/1984)% returns 9
For American date format: %MONTH(9/20/1984)% returns 9
For XML date format: %MONTH(1984-9-20)% returns 9
%DAY(?)%
Accepts a locally formatted date and returns that date's day an integer.
Example:
For common date format: %DAY(20/9/1984)% returns 20
For US date format: %DAY(9/20/1984)% returns 20
For XML date format: %DAY(1984-09-20)% returns 20
%MID(?;?;?)%
Accepts a text string as the first parameter, and returns part of that string based on the second and third integer parameters 2 and 3.ie %MID(<Text String (Text)>;<Start Position (Integer)>;<Length (Integer)>)%
The second parameter determines where in the string to start copying characters from. The third parameter determines how many characters to copy, (this value may exceed the length of the remaining characters, in which case all characters from the start position until the end of the string are returned).
Example:
%MID(Green Widget;2;3)% returns "ree"
%MID(Green Widget;7;6)% returns "Widget"
%MID(Green Widget;1;7)% returns "Green "
%LEN(?)%
Accepts a text string, and returns that string's length as an integer.
Example:
%LEN(Belgium)% returns 7.
%LEN()% returns 0.
%ENCODE(?)%
Accepts a text string, and returns the string with encoded characters, that are not allowed in SharePoint folder or file names.
Example:
%ENCODE(1906/20)% returns "1906_20"
 
? - Question marks should be replaced by values or sub-functions.