×
Menu
Index

Formula functions

 
 
 
SoftRules® knows the following Formula Functions (alphabetically):
 
ADDMONTHS
 
ADDMONTHS(date; months)
Adds months to date.
 
Example:
ADDMONTHS(2009/3/20;6)
 
Result: 2009/9/20
AGE
 
AGE(date)
Returns age in years of date using today as a reference.
 
Example:
AGE([BS_GEBDAT])
 
Result: 35 (depending on BS_GEBDAT and the current date)
AGEAT
 
AGEAT(date; referencedate)
Returns age in years of date using referendedate as a reference.
 
Example:
AGE([Birthday];[Startdate])
 
Result: 35 (depending on Birthday and Startdate obviously)
CHANGED
 
CHANGED(elementname)
Returns True or False if the value of elementname is changed since the last Begin Transaction.
 
Example:
CHANGED(Premium)
 
Result: True
 
CHANGED(elementname; elementnametostorepreviousvalue)
Returns True or False if the value of elementname is changed since the last Begin Transaction and writes the previous value to elementnametostorepreviousvalue.
 
Example:
CHANGED(Premium; #PreviousValue)
 
Result: True (and #PreviousValue contains the previous value)
CHILDCOUNT
 
CHILDCOUNT(path)
Returns the number of childnodes below path.
 
Example:
CHILDCOUNT(Importdemo)
 
Result: 3
CHR
 
CHR(Unicode)
Returns a character by its Unicode value (in Hexadecimal format).
 
Example:
CHR(0000D)
 
Result: <CR>
 
Or:
 
Example:
CHR(D83DDE04)
 
Result: 😄
COMPUTERNAME
 
COMPUTERNAME()
Returns the name of the system that runs SoftRules® .
 
Example:
COMPUTERNAME()
 
Result: CMPSVR17
CONFIGID
 
CONFIGID()
Returns the ID of the current Local Configuration.
 
Example:
CONFIGID()
 
Result: 10
CONTAINS
 
CONTAINS(string; substring)
Returns True if substring is a part of string, otherwise False.
 
Example:
CONTAINS(Toyota Avensis; Avensis)
 
Result: true
COS
 
COS(value1)
Returns the cosine of value1.
 
Example:
COS(90)
 
Result: 0
CURRENTPATH
 
CURRENTPATH()
Returns the current position within the XML document.
 
Example:
CURRENTPATH()
 
Result: CustomerDocument/CustomerWrapper/Insured
DATASETID
 
DATASETID()
Returns the ID of the current Dataset.
 
Example:
DATASETID()
 
Result: 1
DATE2EPOCH
 
DATE2EPOCH(date)
Returns date in Epoch format.
 
Example:
DATE2EPOCH(1970/1/1)
 
Result: 0
 
Or:
 
DATE2EPOCH(2016/2/4)
 
Result: 1454544000
DAY
 
DAY(date)
Returns the day from date.
 
Example:
DAY(2009/3/20)
 
Result: 20
DAYOFWEEK
 
DAYOFWEEK(date)
Returns the day of the week as a number 0 to 6 (stands for Sunday to Saturday)
 
Example:
DAYOFWEEK(NOW())
 
Result: 3
DAYS360
 
DAY360(startdate; enddate)
Calculates the number of days between startdate and enddate based on a year with 12 months of 30 days.
 
Example:
DAY360(2016/1/1; 2016/7/1)
 
Result: 180
DAYSBETWEEN
 
DAYSBETWEEN(startdate; enddate)
Returns the number of days between startdate and enddate.
 
Example:
DAYSBETWEEN(2016/1/1; 2016/7/1)
 
Result: 182
DECREASED
 
DECREASED(elementname)
Returns True is elementname is decreased since the last Begin transaction. Otherwise False.
 
Example
DECREASED(Premium)
 
Result: True
DELETED
 
DELETED(elementname)
Returns True if elementname is deleted since the last Begin Transaction. Otherwise False.
 
Example:
DELETED(Premium)
 
Result: True
E (mathematical constant)
 
E()
Returns e.
 
Example:
E()
 
Result: 2,71828182845905
ENVVAR
 
ENVVAR(envvarname)
Returns the environment variable with name envvarname.
 
Example:
ENVVAR(SystemRoot)
 
Result: C:\WINDOWS
EPOCH2DATE
 
EPOCH2DATE(epochdate)
Returns the date belonging to a epochdate (in Epoch format).
 
Example:
EPOCH2DATE(1454544000)
 
Result: 2016/2/4
EXIST
 
EXIST(elementname)
Returns True if the element with name elementname exists on this location in the XML.
 
Example:
EXIST(Premium)
 
Result: True
Format
 
Format(value; formatstring)
Resturns the formatted value of value, formatted with formatstring. For examples of formatstrings, see: msdn.microsoft.com
 
Format(1.123456;####.##)
 
Result: 1.12
 
Or:
 
Format (1.123456; C)
 
Result: $ 1.12
(Depending on system currency settings)
GUID
 
GUID()
Returns a Globally unique identifier.
 
Example:
GUID().xml
 
Result: c7b794dc37984473b57cf789c2cd759d.xml
HASH
 
HASH(string)
Returns a hashed version of string.
 
Example:
HASH(This line of text will be hashed)
 
Result: A93148E6CDA7FEFF2EC62920D24ED075533DDD99E10C018BEEE46D7CFE0887EE
IIF
 
IIF(expression; truepart; falsepart)
Immediate If, where:
expression is a subformula resulting in a logical operator.
truepart is the part that will returned if expression returns True.
falsepart is the part that will be returned if expression returns False.
 
Example:
IIF(2=3; this is true; this is not true)
 
Result: this is not true
INCREASED
 
INCREASED(value)
Returns True if value is increased since the last Begin transaction. Otherwise returns False.
 
Example:
INCREASED(Premium)
 
Result: True
INDEXOF
 
INDEXOF(string; substring)
Returns the starting position of substring in string. The first character stands on position 0.
 
Result:
INDEXOF(Toyota Avensis; Avensis)
 
Result: 7
INTRODUCED
 
INTRODUCED(elementname)
Returns True if elementname is introduced after the last Begin transaction. Otherwise returns False.
 
Example:
INTRODUCED(Premium)
 
Result: True
IPMT
 
IPMT(rate; per; nper; pv, fv)
Returns the interest payment for a given period per for an investment based on periodic, constant payments and a constant interest rate.
 
rate: The interest rate per period.
per: The period for which you want to find the interest and must be in the range 1 to nper.
nper: The total number of payment periods in an annuity.
pv: The present value, or the lump-sum amount that a series of future payments is worth right now.
fv:  The future value, or a cash balance you want to attain after the last payment is made.
 
Example:
IPMT(0,032;1;30;300000;0)
 
Result: 9600
 
and:
 
IPMT(0,032;30;30;300000;0)
 
Result: 486,95
ISBLANK - Is dit leeg?
 
ISBLANK(value)
Returns True if value is empty. Otherwise returns False.
 
Example:
ISBLANK([Premium])
 
Result: True
ISDATE
 
ISDATE(value)
Returns True is value is a valid date. Otherwise returns False.
 
Example:
ISDATE(2016/1/1)
 
Result: True
 
Or:
 
ISDATE(nodate)
 
Result: False
ISLOGICAL
 
ISLOGICAL(value)
Returns True if value is of type Boolean. Otherwise returns False.
 
Example:
ISLOGICAL(true)
 
Result: True
 
Example:
ISLOGICAL(abc)
 
Result: False
ISNUMBER
 
ISNUMBER(value)
Returns True if value is an integer or decimal number. Otherwise returns False.
 
Example:
ISNUMBER([Premium])
 
Result: True
LASTELEMENTWILDCARD
 
LASTELEMENTWILDCARD()
Returns the last used value in a wildcard.
 
Example:
LASTELEMENTWILDCARD([Relatiedocument/Pakket/Onderdeel/PP/OB/WA/*_BTP])
 
Result: WA
(Example from Dutch AFD standard. At this spot stands an element named WA_BTP. So the wildcard is replaced with WA)
LASTINDEXOF
 
LASTINDEXOF(string; searchstring)
Returns the last position of  searchstring in string.
 
Example:
LASTINDEXOF(This line of text contains two times the word text;text)
 
Result: 46
The first position of string is 0, see below.
This line of text contains two times the word text
00000000001111111111222222222233333333334444444444
01234567890123456789012345678901234567890123456789
LASTPATHWILDCARD
 
LASTPATHWILDCARD()
Returns the last used path in a wildcard.
 
Example:
LASTPATHWILDCARD()
 
 
 
Result: Onderdeel
LEFT
 
LEFT(string; length)
Returns the first part of string with a length of length.
 
Example:
LEFT(Comparity; 4)
Result: Comp
LENGTH
 
LENGTH(string)
Returns the number of character that the given string is long.
 
Example:
LENGTH(Comparity)
Result: 9
LOWER
 
LOWER(string)
Returns all characters from the given string in lowercase.
 
Example:
LOWER(Comparity)
Result: comparity
LOG – Natural logarithm
 
LOG(number)
Returns the natural logarithm of number.
 
Example:
LOG(100)
Result: 4,605
LOG10
 
LOG(number)
Returns the base-10 logarithm of a number.
 
Example:
LOG10(100)
 
Result: 2
MAX
 
MAX(value1; value2)
Returns the maximum of value1 and value2.
 
Example:
MAX(3;4)
 
Result: 4
 
MAX(3;MAX(4;5))
 
Result: 5
MEMORY
 
MEMORY()
Returns the amount of memory in use by SoftRules® in kb.
 
Example:
MEMORY()
 
Result: 285696
MIN
 
Min(value1; value2)
Returns the minimum of value1 and value2.
 
Example:
MIN(3;4)
 
Result: 3
 
MIN(3;MIN(4;5))
Result: 3
MONTH
 
MONTH(date)
Returns the month of date.
 
Example:
MONTH(2009/3/20)
 
Result: 3
NOT
 
NOT(value)
Returns the logical opposite of value.
 
Example:
NOT(True)
 
Result: False
NOW
 
NOW()
Returns the current date and time.
 
Example:
NOW()
 
Result: 23-03-2009 12:03:00
ORIGINALVALUE
 
ORIGINALVALUE(elementname)
Returns the value that elementname had before the the last Begin transaction.
 
Example:
ORIGINALVALUE(Premium)
 
Result: 100
PATHCHANGED
 
PATHCHANGED(path)
Returns True if a value in path has been changed in relation to the input XML document. Otherwise returns False.
 
Example:
PATHCHANGED(CustomerDocument/Contract/Policy)
 
Result: False
PI
 
PI()
Returns pi.
 
Example:
PI()
 
Result: 3,14159265358979
PMT
 
PMT(rate; nper; pv; fv)
Calculates the payment for a loan (pv) based on constant payments and a constant interest rate.
 
rate: The interest rate per period.
nper: The total number of payment periods in an annuity.
pv: The present value, or the lump-sum amount that a series of future payments is worth right now.
fv:  The future value, or a cash balance you want to attain after the last payment is made.
 
Example:
PMT(0,032;30;300000;0)
 
Result: 15704,11
(is the value per year for a loan of 300.000 and a total period of 30 years, with an interest of 3,2% and an endvalue of 0)
POW
 
POW(x;y)
Returns x to the power of y. Same as x^y.
 
Example:
POW(2;3)
 
Result: 8
PPMT
 
PPMT(rate; per; nper; pv, fv)
 
Returns the payment on the principal for a given period for an investment based on periodic, constant payments and a constant interest rate.
 
rate: The interest rate per period.
per: The period for which you want to find the interest and must be in the range 1 to nper.
nper: The total number of payment periods in an annuity.
pv: The present value, or the lump-sum amount that a series of future payments is worth right now.
fv:  The future value, or a cash balance you want to attain after the last payment is made.
 
Example:
PPMT(0,032;1;30;300000;0)
 
Result: 6104,11
 
and:
 
PPMT(0,032;30;30;300000;0)
 
Result: 15217,16
RANDOM
 
RANDOM(valuemin; valuemax)
Returns a random number between valuemin and valuemax.
 
Example:
RANDOM(1;100)
 
Result: 55
REGEX
 
REGEX(input; pattern)
En regulair expression is a means to describe a pattern in a text (or element). The result will be True or False. The syntax of regulair expressions can be found here : www.regular-expressions.info
 
Example (to check if a value follows the rules of a Dutch zipcode):
REGEX([Zipcode];[0-9][0-9][0-9][0-9] [A-Z][A-Z])
 
Result: True
 
Or:
 
REGEX([Zipcode];^{d4}[A-Z]{2}$)
 
Result: True
REPLACE
 
REPLACE(string; substring1; substring2)
Replaces substring1 with substring2 in the given string.
 
Example:
REPLACE(22,95;,;.)
 
Result: 22.95
RIGHT
 
RIGHT(string; length)
Returns the right part of a string with the given length.
 
Example:
RIGHT(Comparity; 4)
 
Result: rity
SIN
 
SIN(value)
Returns the sine of value.
 
Example:
SIN(90)
 
Result: 1
SPLIT
 
SPLIT(string; separator; index)
Returns the value out of string, standing on position index if we seen string as an array where items are separated by separator.
 
Example:
SPLIT(Comparity,Rijtuigweg,12,Bergen op Zoom,+31164257800,support@comparity.nl;,;6)
 
Result: support@comparity.nl
SPLITCOUNT
 
SPLITCOUNT(string; separator)
Returns the number of items in string if we see string as an array where the items are separated by separator.
 
Example:
SPLITCOUNT(Comparity,Rijtuigweg,12,Bergen op Zoom,+31164257800,support@comparity.nl;,)
 
Result: 6
SQRT
 
SQRT(value)
Returns the square root of value.
 
Example:
SQRT(9)
Result: 3
SUBSTR
 
SUBSTR(string; start; length)
Returns a part of string. The position of the first character is indicated with the start parameter. The number of characters with the length parameter. The first character stands on position 0.
 
Example:
SUBSTR(Comparity; 6; 2)
Result: it
 
SUBSTR(Comparity; 0; 4)
Result: Comp
TEXTVALUE
 
TEXTVALUE(elementname)
Returns the Text value of elementname only if this element is coupled to a TextValue.
 
Example:
TEXTVALUE(OB_BRANSTO)
 
Result: Diesel
(OB_BRANSTO is part of the Dutch AFD standard and contains the codes B, D en G for Benzine, Diesel en LPG, in this example it contains the value D)
TIME
 
TIME()
Returns the current time.
 
Example:
TIME()
 
Return: 12:03:00
TODAY
 
TODAY()
Returns the current date.
 
Example:
TODAY()
Returns: 2009/3/27
TRIM
 
TRIM(string)
Returns string with all leading and trailing spaces removed.
 
Example:
[STRING1]+[STRING2]
 
Return:            Comparity                               SoftRules
 
Trim([STRING1])+ [STRING2]
 
Returns: Comparity SoftRules
UPPER
 
UPPER(string)
Returns string in uppercase.
 
Example:
UPPER(Comparity)
 
Returns: COMPARITY
UPPERFIRST
 
UPPERFIRST(string)
Returns string with the first character in uppercase.
 
Example:
UPPERFIRST(comparity)
 
Returns: Comparity
UPPERWORDS
 
UPPERWORDS(string)
Returns string with every first character of each word in uppercase.
 
Example:
UPPERWORDS(the quick brown fox jumps over the lazy dog)
 
Returns: The Quick Brown Fox Jumps Over The Lazy Dog
VERSION - SoftRules Versie
 
VERSION()
Returns the SoftRules® version.
 
Example:
VERSION()
 
Returns: 2.0.0.0
XMLROOT
 
XMLROOT()
Returns the name of the root element of the Out XML Document.
 
Example:
XMLROOT()
 
Returns: CustomerDocument
XPATH
 
XPATH(xpathexpression)
Returns the value of the first node of an xpath expression xpathexpression.
 
Example:
XPATH(//Premium)
 
Returns: 100
YEAR
 
YEAR(date)
Returns the year of date.
 
Example:
YEAR(2009/3/29)
 
Returns: 2009