Your browser does not support JavaScript!
You are here: Transaction Rules > Transaction Elements > Math Elements > MathVariable Element

MathVariable Element

Within the <Math> element, calculations can be evaluated using MathVariables.  MathVariables are variables that are used in the Math section of business rule configuration and use the <MathVariable> tag.  A MathVariable name is assigned as the value of the attribute VARIABLENAME.  After you name the MathVariable, you will identify what type of MathVariable you want to create.  There are various types of MathVariables available to configure processing.  MathVariables can be used to retrieve a field value, create arrays, structure if-then structures, perform calculations with operators or call functions.  Each of the math types has its own set of attributes, elements and possible values, which are listed below.  All MathVariables must have a data type declared using the DATATYPE attribute.

The <MathVariable> tag can use a LOG="Yes" attribute, which will log results to AsActivityMath. When using logging, remember that the system performs all logging at the end of transaction processing. Therefore, only the ending value of a MathVariable is logged. Although the configuration allows the LOG attribute on any use of a variable in the configuration, the intermediate values are not logged, even if LOG="Yes" occurs multiple times for the same variable. In such a case, to avoid confusion it is best to specify the LOG attribute only for the last use of the variable. Another method is to create a "Log Section" at the bottom of the configuration that specifies all math variables to be logged.

There are also <MathLoop> and <MathIF> elements, which are available to perform loops and if conditions, respectively.  Both must have a data type declared as well.

Available DATATYPE Options

DATATYPE of either decimal or integer may not be blank, and a DEFAULT attribute must be defined.

If you will be dealing with integers that are larger than 2147483648 in math configuration then the DECIMAL data type must be used.

MathVariables may be used to pass values into spawn configuration.  Math statements are processed sequentially from top to bottom in the configuration. 

XML Example

<MathVariables>
<!-- Calculate Days from Last Bank Draft -->
<MathVariable VARIABLENAME="LastActiveBankDraftEffectiveDate" TYPE="VALUE" 
DATATYPE="DATE"></MathVariable>
<MathVariable VARIABLENAME="BankDraftEndDate" TYPE="FIELD" 
DATATYPE="DATE">Activity:EffectiveDate</MathVariable>
<MathVariable VARIABLENAME="LastActiveBankDraftEffectiveDate" TYPE="SQL" DATATYPE="DATE">
<SqlServer>SELECT TOP 1 AsActivity.EffectiveDate FROM AsActivity 
JOIN AsTransaction ON AsTransaction.TransactionGUID = AsActivity.TransactionGUID 
AND AsTransaction.TransactionName = 'BankDraft' 
WHERE AsActivity.PolicyGUID = '[Policy:PolicyGUID]' 
AND AsActivity.StatusCode IN ('01','13','14') 
AND AsActivity.TypeCode IN ('01','04') 
ORDER BY AsActivity.EffectiveDate DESC
</SqlServer>
<Oracle>SELECT EffectiveDate FROM (SELECT AsActivity.EffectiveDate FROM AsActivity 
JOIN AsTransaction ON AsTransaction.TransactionGUID = AsActivity.TransactionGUID 
AND AsTransaction.TransactionName = 'BankDraft' 
WHERE AsActivity.PolicyGUID = '[Policy:PolicyGUID]' 
AND AsActivity.StatusCode IN ('01','13','14') 
AND AsActivity.TypeCode IN ('01','04') 
ORDER BY AsActivity.EffectiveDate DESC) WHERE ROWNUM = 1
</Oracle>
<DB2>SELECT AsActivity.EffectiveDate FROM AsActivity 
JOIN AsTransaction ON AsTransaction.TransactionGUID = AsActivity.TransactionGUID 
AND AsTransaction.TransactionName = 'BankDraft' 
WHERE AsActivity.PolicyGUID = '[Policy:PolicyGUID]' 
AND AsActivity.StatusCode IN ( '01' , '13' , '14' ) 
AND AsActivity.TypeCode IN ( '01' , '04' ) 
ORDER BY AsActivity.EffectiveDate DESC FETCH FIRST 1 ROWS ONLY
</DB2>
</MathVariable>
<MathVariable VARIABLENAME="TestLastActiveBankDraft" TYPE="FUNCTION" 
DATATYPE="BOOLEAN">IsEmpty(LastActiveBankDraftEffectiveDate)</MathVariable>
<MathIF IF="TestLastActiveBankDraft = false">
<MathVariable VARIABLENAME="DaysFromLastBankDraft" TYPE="FUNCTION" 
DATATYPE="INTEGER">DaysDiffOf(LastActiveBankDraftEffectiveDate,BankDraftEndDate)</MathVariable>
</MathIF>
<MathVariable VARIABLENAME="CommentToSpawn" TYPE="FIELD" 
DATATYPE="BIGTEXT">Activity:AnnualStatementComment</MathVariable>
<MathVariable VARIABLENAME="XmlValueMV" TYPE="VALUE" DATATYPE="XML"/>
<MathVariable VARIABLENAME="XmlFieldlMV" TYPE="FIELD" DATATYPE="XML">Activity:XMLData</MathVariable>
<MathVariable VARIABLENAME="CorrectionDateMV" TYPE="MULTIFIELD" INDEX="1" DATATYPE="DATE">CorrectionDate</MathVariable>
</MathVariables>

Copyright © 2009, 2013, Oracle and/or its affiliates. All rights reserved. Legal Notices