InRule® includes a Standard Template Catalog that allows for Business Language entry of conditions, expressions, and actions. Rules may be entered “Topic First” (starting with the current context) or “Template First” — picking a template then filling it out.
Available templates are displayed based on context as a rule is authored. The user is prompted to define necessary fields or tokens, and is presented with a menu of appropriate choices.
The following categories contain all function templates for authoring expressions in Language Rules.
- Collection Templates - Operate across collection items to return aggregate values.
- Comparison Templates - Return values based on logical comparisons.
- Conditional Templates - Return values based on logical operations.
- Conversion Templates - Perform data type conversions.
- Date Templates - Perform date parsing and math operations.
- Math Templates - Perform arithmetic operations.
- Time-Value Templates - Perform time-value financial operations.
- Text Templates - Perform string manipulation and formatting.
- Value List Templates - Perform operations against value lists.
- Expression Designer Templates - Allows combining syntax rules with business language rules.
- Logical Templates - Perform logical operations.
- XML Templates - Perform operations against XML files.
- Validity Templates - Perform validations.
- Action Templates - Trigger actions.
References
Collection Templates
Collection templates perform lookup and aggregate functions over a collection. They can filter out specific collection members to operate over.
Template name | Template format | Return type |
lookup | lookup <expression> from <collection> where <filter> otherwise use <default> | type of evaluated expression |
member number | member number <index> in <collection> | entity reference |
the average of | the average of <numeric expression> in <collection> | integer or decimal |
the first matching member from | the first matching member from <collection> where <filter expression> | entity reference |
the first member in | the first member in <collection> | entity reference |
the last member in | the last member in <collection> | entity reference |
the number of | the number of <collection> | integer |
any members exist in | any members exist in <collection> filtered by <filter expression> | Boolean |
no members exist in | no members exist in <collection> filtered by <filter expression> | Boolean |
the total of | the total of <numeric expression> in <collection> | integer or decimal |
the minimum of | the minimum of <numeric expression> in <collection> | integer or decimal |
the maximum of | the maximum of <numeric expression> in <collection> | integer or decimal |
get first value | the value of <field> on the first member in <collection> otherwise use <default> | field value |
get last value | the value of <field> on the last member in <collection> otherwise use <default> | field value |
the value of a member at an index | the value of <field> on member number <integer> from <collection> otherwise use <default> | field value |
Comparison Templates
Comparison functions evaluate to Boolean by comparing values to the left and right of the operator.
Function | Template format | Return type |
is among | <field> is among <value>, <value>, [add value] *List of values of same data type as left side of comparison | Boolean |
is not among |
<field> is not among <value>, <value>, [add value] *List of values of same data type as left side of comparison |
Boolean |
is at leas | <numeric> is at least <numeric expression> | Boolean |
is at most | <numeric> is at most <numeric expression> | Boolean |
is between | <date or numeric> is between <date or numeric expression> and <date or numeric expression> | Boolean |
is not between | <date or numeric> is not between <date or numeric expression> and <date numeric expression> | Boolean |
is equal to |
<Field> is equal to <value> *value of same data type as left side of comparison |
Boolean |
is not equal to |
<field> is not equal to <value> *value of same data type as left side of comparison |
Boolean |
is empty | <field> is empty | Boolean |
is not empty | <field> is not empty | Boolean |
is a number | <value> is a number | Boolean |
is greater than | <numeric> is greater than <numeric expression> | Boolean |
is greater than or equal to | <numeric> is greater than or equal to <numeric expression | Boolean |
is less than | <numeric> is less than <numeric expression> | Boolean |
is less than or equal to | <numeric> is less than or equal to <numeric expression> | Boolean |
is after | <date> is after <date expression> | Boolean |
is on or after | <date> is on or after <date expression> | Boolean |
is not after | <date> is not after <date expression> | Boolean |
is before | <date> is before <date expression> | Boolean |
is not before | <date> is not before <date expression> | Boolean |
is on or before | <date> is on or before <date expression> | Boolean |
is null or empty | <field> is null or empty | Boolean |
is not null or empty | <field> is not null or empty | Boolean |
is true | <Boolean> is true | Boolean |
is false | < Boolean> is false | Boolean |
Conditional Templates
Conditional templates evaluate the Boolean expressions in a list. Conditional templates are extremely useful for grouping multiple rule conditions and make it easy to add new conditions.
Template name | Template format | Return type |
all | all of the following are true (or false) | Boolean |
any | any of the following are true (or false) | Boolean |
at least | at least <number> of the following are true (or false) | Boolean |
at most | at most <number> of the following are true (or false) | Boolean |
exactly | exactly <integer> of the following are true (or false) | Boolean |
more than | more than <number> of the following are true (or false) | Boolean |
less than | less than <number> of the following are true (or false) | Boolean |
other than | other than <number> of the following are true (or false) | Boolean |
none | none of the following are true (or false) | Boolean |
Append condition templates allow the rule conditions to be appended with other conditions.
and | and <condition> | na |
or | or <condition> | na |
Conversion Templates
Conversion templates are used to convert one datatype to another. To use a conversion template, the user must first select convert from the menu.
Template name | Template format | Return type |
to upper case | convert <value> to uppercase | text |
to lower case | convert <value> to lowercase | text |
to proper case | convert <value> to proper case | text |
to Boolean | convert <value> to Boolean | Boolean |
to integer | convert <value> to integer | integer |
to date | convert <value> to date | date |
to datetime | convert <value> to datetime | datetime |
to time | convert <value> to time | time |
to number | convert <value> to number | number |
to inner XML | convert <value> to inner XML | XML |
to text | convert <value> to text | text |
Date Templates
Date templates are used to manipulate dates and datetime fields.
Template name | Template format | Return type |
current day | current day | integer |
current hour | current hour | integer |
current millisecond | current millisecond | integer |
current minute | current minute | integer |
current month | current month | integer |
current second | current second | integer |
current year | current year | integer |
day from | day from <date or datetime> | integer |
day of the month from | day of the month from <date or datetime> | integer |
day of the week from | day of the week from <date or datetime> | integer |
day of the year from | day of the year from <date or datetime> | integer |
days between | days between <date or datetime> and <date or datetime> | integer |
weekdays between | weekdays between <date or datetime> and <date or datetime> | integer |
get local datetime from | get local datetime from <datetime> | datetime value having a local kind |
get unspecified datetime from | get unspecified date time from <datetime> | datetime value having a unspecified kind |
get UTC datetime from | get UTC datetime from <datetime> | datetime value having a UTC kind |
hours from | hour from < datetime> | integer |
hours between | hours between <datetime> and <datetime> | integer |
millisecond from | millisecond from <datetime> | integer |
milliseconds between | milliseconds between <datetime> and <datetime> | integer |
minute from | minute from < datetime> | integer |
minutes between | minutes between <datetime> and <datetime> | integer |
month from | month from <date or datetime> | integer |
months between | months between <date or datetime> and <date or datetime> | integer |
now |
now | datetime |
number of days in the month from | number of days in the month from <date> | integer |
number of days in the year from | number of days in the year from | integer |
second from | second from < datetime> | integer |
seconds between | seconds between <datetime> and <datetime> | integer |
today | today | date |
tomorrow | tomorrow | date |
year from | year from <date> | integer |
years between | years between <date> and <date> | integer |
yesterday | yesterday | date |
is a leap year | <datetime> is a leap year | Boolean |
is a local datetime | <datetime> is a local datetime | Boolean |
is a week day | <datetime> is a week day | Boolean |
is an unspecified datetime | <datetime> is an unspecified datetime | Boolean |
is an UTC datetime | <datetime> is an UTC datetime | Boolean |
is on a week end | <datetime> is on a week end | Boolean |
minus | <datetime> minus <timespan> | |
plus |
<datetime> plus <timespan> | |
plus |
<date or datetime> plus <integer> weekdays | date or datetime |
is a date | <text> is a date | Boolean |
is a datetime | <text> is a datetime | Boolean |
Math Templates
Math templates are used to operate over numerical values and handle complex math operations.
Template name | Template format | Return type |
% of | <number> % of <number> | number |
divided by | <number> divided by <number> | number |
minus | <number> minus <number> | number |
modulus | <number> modulus <number> | integer |
multiplied by | <number> multiplied by <number> | number |
plus | <number> plus <number> | number |
raised to | <number> raised to <number> | number |
rounded to | <number> rounded to <digits> decimal places | number |
rounded up to | <number> rounded up to <digits> decimal places | number |
rounded down to | <number> rounded down to <digits> decimal places | number |
rounded with bankers rounding to | <number> rounded with bankers rounding to <digits> decimal places | number |
squared | <number> squared | number |
absolute value of | absolute value of <value> | number |
largest of | largest of <add> | number |
smallest of | smallest of <add> | number |
square root of | square root of <value> | number |
the natural log base e raised to | the natural log base e raised to <number> | number |
the natural log of | the natural log of <number> | number |
the number of digits before the decimal point in | the number of digits before the decimal point in <number> | integer |
the number of digits after the decimal point in | the number of digits after the decimal point in <number> | integer |
the number of digits in | the number of digits in <number> | integer |
Time-Value Templates
Time-Value templates used for common financial operations.
Template name | Template format | Return type |
future value of | the future value of <present lump sum amount> using rate <interest rate> over <number of periods> | number |
interest rate over | the interest rate over <number of periods> for present value of <present lump sum amount> and future value of <future lump sum amount> | number |
payment for | the payment for <present lump sum amount> using rate <interest rate> over <number of periods> | number |
present value of | present value of <future lump sum amount> using rate <interest rate> over <number of periods> | number |
Text Templates
Text templates are used to lookup or modify text values.
Template name | Template format | Return type |
matches regular expression | <text> matches regular expression <regex pattern> | Boolean |
matches wild card expression | <text> matches regular expression <wild card pattern> | Boolean |
with no leading or trailing spaces | <text> with no leading or trailing spaces | text |
with whitespace removed | <text> with whitespace removed | text |
contains whitespace | <text> contains whitespace | Boolean |
contains | <text> contains <text> | Boolean |
starts with | <text> starts with <text> | Boolean |
ends with | <text> ends with <text> | Boolean |
the left | the left <number> of characters in <text> | text |
the right |
the right <number> of characters in <text> | text |
the middle |
the middle <number> of characters in <text> starting with character <number> | text |
length of | the length of <text> | text |
formatted as currency | <number> formatted as currency | text |
formatted as hexadecimal | <number> formatted as Hexadecimal | text |
formatted as number | <number> formatted as number | text |
formatted as percent | <number> formatted as percent | text |
formatted as scientific | <number> formatted as scientific | text |
combine | combine <value> with <value> | text |
concatenate |
concatenate <values> or use the & operator: <text> & <text> |
text |
format |
format <date> as <format> (Note: templates for <format> are long date, long datetime, long time, short date, short datetime, short time, year month) |
text |
get position of | get position of <search text> in <target text> | number |
replace | replace <old text> in <text> with <new text> | text |
replace pattern | replace <regex pattern> in <text> with <text> | text |
select text from | select text from <text> which matches regular expression <regex pattern> | text |
Value List Templates
Value List templates are used to check if a Value is found in the Value List.
Template name | Template format | Return type |
has a value of | <field> has a value of <add list value> | Boolean |
does not have a value of | <field> does not have a value of <add list value> | Boolean |
is in | <field> is in <value list> | Boolean |
the display value from | <field> the display value from <value list> | text |
create list of | create list of <field> in <collection> | list |
with a new value list | <values> | list |
from existing value list | <value list> with <values> | list |
Expression Designer Templates
The expression designer template allows users to build complex expressions using syntax rule functions. This feature enables the user to combine syntax rules with business language rules. This can be very useful for managing complex parenthetical formulas or functions that are not supported as business language templates.
Template name | Template format | Return type |
design expression | expression value | na |
safe expression | <expression> otherwise use <default> | expression value |
Example:
set Payment Summary Monthly Payment to Round((((LoanInfo.Principal * monthlyRate) / (1 - ((1 + monthlyRate) ^ (LoanInfo.TermInMonths * -1)))) * 100) / 100, 2)
Logical Templates
Logical templates may be used to influence the evaluation of the conditional templates.
Template name | Template format | Return type |
exactly one of | exactly one of <enter condition> | Boolean |
not | not ... | Boolean |
XML Templates
XML template is used to lookup data from an XML file.
Template name | Template format | Template format |
lookup | lookup<XPath query expression> | text |
Validity Templates
Validity templates are used to check the validity of a Field or Entity, which may have been set from Constraints or the Mark Field As Invalid / Set Field Invalid action.
Template name | Template format | Template format |
is not valid | <field> is not valid | Boolean |
is valid | <field> is valid | Boolean |
Action Templates
Action templates are used to trigger actions. There is no return type.
Template name | Template format |
activate rule set | deactivate rule set <rule set> |
add collection member | launches syntax editor |
copy collection | launches syntax editor |
deactivate rule set | deactivate rule set <rule set> |
execute database query | launches syntax editor |
execute decision table | launches syntax editor |
execute rule set |
execute rule set <rule set> w/ Parameterized Rule Set: execute rule set <rule set> using (ParamName = <value>) |
execute REST service | launches syntax editor |
execute web service | launches syntax editor |
execute xpath query | launches syntax editor |
fire notification |
fire notification <message> with the following settings as notification type <warning|error> associated with <field> |
halt all rule execution | halt all rule execution and log message <message text> |
halt rule set | halt rule set and log message <message text> |
mark field as invalid* | mark <field> invalid and display message <text message> |
raise event | launches syntax editor |
refresh fields | refresh fields <add field> |
send e-mail | launches syntax editor |
set the value to a field | set <field> to <value> |
sort collection | launches syntax editor |
* The "mark field as invalid" Business Language template is the equivalent of the Syntax action for Set Field Invalid.
Comments
0 comments
Please sign in to leave a comment.