Set instruction

The set instruction allows for a variable that is declared in the ##Define instruction to be updated with a new value. The set instruction accepts two parameters: 'variable' which is the name of the variable to be updated and 'value' which refers to the new variable value or reference.
The set statement has the following format:
##Set(variable, value)
The syntax for using the value of the variable in a template has the following format:
[d.{variable}]
Example:
##Set(myObjName, "[1.{ObjectName}]") ##Set(myObjNameLength, [1.{ObjectName.Length}])
A number of standard Microsoft functions can be used with the instruction when assigning or manipulating the value and are listed in the following table.
Function
Example
Round
##Set(myRound,Round(87.6))
Format
##Set(myFormat, Format(87.6, "###0.00"))
Modulus
##Set(myMod, Modulus(5,4))
ABS
##Set(myABS, ABS(-87.6))
INT
##Set(myINT, INT(87.6))
Length
##Set(myLength, Length("[1.{ObjectDescription}]"))
Ucase
##Set(myUpperCase, Ucase("[1.{ObjectDescription}]"))
Lcase
##Set(myLowerCase, Lcase("[1.{ObjectDescription}]"))
Truncate
##Set(myTruncate, Truncate([1.{MaxValue}]))
Sin
##Set(mySin, Sin(87.6))
Cos
##Set(myCos, Cos(87.6))
Tan
##Set(myTan, Tan(87.6))
now()
##Set(myDateTime, now())
##Set(myDateTimeFormated, Format(now(), "dd MMM yyyy"))
Today()
##Set(myDate, Today())
Rnd()
##Set(myRandomize, Rnd())
Trim
##Set(myTrim, Trim("[1.{ObjectDescription}]"))
IndexOf
##Set(myIndexOf, IndexOf("[1.{ObjectDescription}]", "word"))
Mid
##Set(myMid1, Mid("[1.{ObjectDescription}]", 12, 22))
Right
##Set(myRight, Right("[1.{ObjectDescription}]", 12))
Left
##Set(myLeft, Left("[1.{ObjectDescription}]", 22))
Substring
##Set(mySubString1, substring("[1.{ObjectDescription}]", 12, 22))
Pow
##Set(myPower, Pow(2, 0) + Pow(2, 1) + Pow(2, 2) + Pow(2, 3) + Pow(2, 4))
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.
Normal