ScreenMath Element
Use the ScreenMath element in screen rule configuration to perform calculations, evaluate expressions, and set variables. the ScreenMath uses mathstatement to supports valuation. The valuation executes on OnLoad and OnChange events, and calculates the accurate value as of valuation date.
Element/Tab | Parent Element | Definition | Attribute | Element/Attribute Values |
---|---|---|---|---|
<ScreenMath> |
Opening tag for ScreenMath | |||
<Math>
|
<ScreenMath> |
Opening and closing tag for Math element. |
|
|
<Math> |
Required: |
ID |
Text |
|
<Math> |
Required: |
GLOBAL |
Yes or No |
|
<MathVariables> |
<Math> |
Required: Sets parent tag for all the Math Variables |
|
|
<MathStatement> | <Math> | |||
<MathStatement> |
|
TYPE |
ActivityFunction Literal value only |
|
<MathStatement> |
Required: Name of Statement Function. |
FUNCTIONNAME | MathValuation | |
<Parameters> | <MathStatement> | |||
<Parameter> | <Parameters> |
Required: Defines the date for valuation. |
A field or math variable containing a date. Must be a Date datatype. |
|
<Parameter> |
Required: Defines the valuation date. |
NAME |
ValuationDate Literal value only |
|
<Parameter> |
Required: Function parameter. type: Input/Output |
TYPE | INPUT | |
<Parameter> | <Parameters> |
Required: Specifies whether the PolicyValues business rule executes during the valuationprocess on each policy. |
A literal, a field, or math variable containing a "Yes" or "No" text string. | |
<Parameter> |
Required: Defines the parameter to assign the value |
NAME |
PolicyValues Literal value only |
|
<Parameter> |
Required: Function parameter. type: Input/Output |
TYPE | INPUT | |
<Parameter> | <Parameters> |
Required: No: Indicates the valuation is to be calculated with the exact prices as of the ValuationDate. Yes: Indicates the valuation is to be calculated using the last known prices as of the ValuationDate. If this value is set to No and there are no prices for the specified valuation date, a business error occurs indicating fund prices do not exist for the specified valuation date. |
A literal, a field, or math variable containing a "Yes" or "No" text string. | |
<Parameter> |
Required: Defines the parameter to assign the value |
NAME |
NearestPrice Literal value only |
|
<Parameter> |
Required: Function parameter. type: Input/Output |
TYPE | INPUT | |
<Parameter> | <Parameters> |
Optional: The ExactPriceDateUsed output parameter returns true or false to indicate whether the fund prices used to value the policy were as of the exact ValuationDates specified (true) or the nearest price dates (false). The NearestPrice parameter must be set to "Yes" to use this output. If NearestPrice is set to “No” the output value will always be "true" when the activity processes. |
A field or math variable containing a text value of "true" or "false." | |
<Parameter> |
Required: A math variable to hold the function output. |
NAME |
ExactPriceDateUsed Literal value only |
|
<Parameter> |
Optional: Function parameter type: Input/Output. |
TYPE | OUTPUT | |
<Parameter> | <Parameters> |
Optional: Defines the parameter to assign value. |
Yes: Financial entry calculations and math need to be executed in PolicyValues BR. IsValueFinancialEntry context value will be assigned a value as "Yes." No: No financial entry calculation in PolicyValues IsValueFinancialEntry will have value "No." Default Value ="No" |
|
<Parameter> |
Required: Assign Values for Parameter Literal Value, Field Value, or MathVaraible. |
NAME |
ValueFinancialEntry |
|
<Parameter> |
Required Function parameter type |
TYPE | INPUT | |
<MathVariable> |
<ScreenMath> |
Optional: Sets parent tag for all the Math Variables. |
|
|
<MathIF> |
<ScreenMath> |
Optional: Sets parent tag for all the MathIf. See MathIF Element. |
|
|
<MathLoop> |
<OnLoad> |
Optional: Sets parent tag for all the MathLoop. |
|
|
XML Schema
<ScreenMath>
<Math ID="" GLOBAL="">
<MathVariables>
<MathStatement TYPE=¿ACTIVITYFUNCTION¿ FUNCTIONNAME="MathValuation">
<Parameters>
<Parameter NAME=¿ValuationDate¿ TYPE="INPUT">MyValuationDate</Parameter>
<Parameter NAME=¿PolicyValues¿ TYPE="INPUT">Yes</Parameter>
<Parameter NAME=¿NearestPrice¿ TYPE="INPUT">Yes</Parameter>
<Parameter NAME=¿ExactPriceDateUsed¿ TYPE="OUTPUT">ExactPriceDateUsedMV</Parameter>
<Parameter NAME=¿ValueFinancialEntry¿ TYPE="INPUT">NO</Parameter>
</Parameters>
</MathStatement>
<MathIf> </MathIf>
<MathLoop> </MathLoop>
</MathVariables>
</Math>
</ScreenMath>
XML Example
"<?xml version="1.0" encoding="UTF-8"?>
<Transaction>
<EffectiveDate STATUS="Enabled" TYPE="SYSTEM"/>
<Valuation>
<EffectiveDateNUVMustExist>No</EffectiveDateNUVMustExist>
<SystemDateNUVMustExist>No</SystemDateNUVMustExist>
</Valuation>
<Fields>
<Field>
<Name>WithdrawalType</Name>
<Display>Type of Withdrawal</Display>
<DataType>Radio</DataType>
<DefaultValue>01</DefaultValue>
<Query TYPE="FIXED">
<Options>
<Option>
<OptionValue>01</OptionValue>
<OptionText>Partial</OptionText>
</Option>
<Option>
<OptionValue>02</OptionValue>
<OptionText>Full</OptionText>
</Option>
</Options>
</Query>
<Disabled>Yes</Disabled>
</Field>
<Field>
<Name>Filler</Name>
<DataType>Blank</DataType>
</Field>
<Field>
<Name>Amount</Name>
<Display>Withdrawal Amount</Display>
<DataType>Money</DataType>
<Disabled>ReadOnly</Disabled>
<Currency>USD</Currency>
<Expanded>Yes</Expanded>
<DefaultValue>0</DefaultValue>
</Field>
</Fields>
<Events>
<Event TYPE="ONLOAD">
<ActionSet ID="OnChangeWithdrawalType"/>
</Event>
<Event TYPE="ONCHANGE" FIELD="WithdrawalType">
<ActionSet ID="OnChangeWithdrawalType"/>
</Event>
<Event TYPE="ONCHANGE" FIELD="Amount">
<ActionSet ID="VerifyAmount"/>
</Event>
<Event TYPE="ONSUBMIT">
<ActionSet ID="VerifyAmount"/>
</Event>
<Event Type="ONLOAD" FIELD="EffectiveDate">
<Math ID="ValuationScreenMath"></Math>
<ActionSet ID="OnLoadEffectiveDate"/>
</Event>
<Event TYPE="ONCHANGE" FIELD="EffectiveDate">
<Math ID="ValuationScreenMath"></Math>
<ActionSet ID="OnChangeEffectiveDate"/>
</Event>
</Events>
<ScreenMath>
<Math ID="ValuationScreenMath" GLOBAL="No">
<MathStatement TYPE=¿ACTIVITYFUNCTION¿ FUNCTIONNAME="MathValuation">
<Parameters>
<Parameter NAME=¿ValuationDate¿ TYPE="INPUT">EffectiveDate</Parameter>
<Parameter NAME=¿PolicyValues¿ TYPE="INPUT">Yes</Parameter>
<Parameter NAME=¿NearestPrice¿ TYPE="INPUT">Yes</Parameter>
<Parameter NAME=¿ExactPriceDateUsed¿ TYPE="OUTPUT">ExactPriceDateUsedMV</Parameter>
<Parameter NAME=¿ValueFinancialEntry¿ TYPE="INPUT">Yes|No| OR MathVariable or Field with Values(Yes|No)</Parameter>
</Parameters>
</MathStatement>
<MathVariables>
<MathVariable VARIABLENAME="PolicyValueX" TYPE="VALUATIONVALUE" CONTEXT="MATH" VALUATIONTYPE="POLICY" DATATYPE="DECIMAL">CashValue</MathVariable>
<MathVariable VARIABLENAME="MyFundGUID" TYPE="SQL" DATATYPE="TEXT">SELECT FundGUID FROM¿</MathVariable>
<MathVariable VARIABLENAME="FundGainX" TYPE="VALUATIONVALUE" CONTEXT="MATH" VALUATIONTYPE="FUND" FUNDGUID="MyFundGUID" DATATYPE="DECIMAL"">Gain</MathVariable>
</MathVariables>
</Math>
<Math ID="GlobalScreenMathMath" GLOBAL="Yes">
<MathVariables>
<MathVariable VARIABLENAME="ZeroCurrency" TYPE="FUNCTION" DATATYPE="CURRENCY">ToCurrency(0,"USD")</MathVariable>
<MathVariable VARIABLENAME="FirstInvestmentDate" TYPE="SQL" DATATYPE="DATE">SELECT * FROM (SELECT act.EffectiveDate FROM AsActivity act JOIN AsTransaction tran ON tran.TransactionGUID = act.TransactionGUID AND tran.TransactionName = 'InitialPremium' WHERE act.PolicyGUID = '[PolicyGUID]' AND act.TypeCode IN ('01','04') AND act.StatusCode = '01' ORDER BY act.ActivityGMT) WHERE ROWNUM = 1</MathVariable>
<MathVariable VARIABLENAME="FirstInvestmentDateTxt" TYPE="FUNCTION" DATATYPE="TEXT">ToText(FirstInvestmentDate)</MathVariable>
</MathVariables>
</Math>
</ScreenMath>
<Actions>
<ActionSet ID="OnLoadEffectiveDate">
<Action ACTIONTYPE="ASSIGN" FIELD="CashValue">0</Action>
</Actionset>
<ActionSet ID="OnChangeEffectiveDate">
<Action ACTIONTYPE="ASSIGN" FIELD="CashValue">0</Action>
</Actionset>
<ActionSet ID="OnChangeWithdrawalType">
<Condition IF="WithdrawalType = '01'">
<Action ACTIONTYPE="ENABLE" FIELD="Amount"/>
<Else>
<Action ACTIONTYPE="DISABLE" FIELD="Amount"/>
<Action ACTIONTYPE="ASSIGN" FIELD="Amount">0</Action>
</Else>
</Condition>
</ActionSet>
<ActionSet ID="VerifyAmount">
<Condition IF="WithdrawalType = '01' And (IsEmpty(Amount) Or Amount = GlobalScreenMath:ZeroCurrency)">
<Action ACTIONTYPE="ERROR" FIELD="Amount">Must be greater than 0</Action>
</Condition>
</ActionSet>
<ActionSet ID="OnChangeEffectiveDate">
<Condition IF="Not IsEmpty(EffectiveDate) And EffectiveDate <= GlobalScreenMath:FirstInvestmentDate">
<Action ACTIONTYPE="ERROR">Effective Date must be after the first investment: $$$GlobalScreenMath:FirstInvestmentDateTxt$$$.</Action>
</Condition>
</ActionSet>
</Actions>
<Math>
<MathVariables>
<MathVariable VARIABLENAME="PolicyIssueDate" TYPE="POLICYFIELD" DATATYPE="DATE">IssueDate</MathVariable>
<MathVariable VARIABLENAME="ActivityEffectiveDate" TYPE="FIELD" DATATYPE="DATE">Activity:EffectiveDate</MathVariable>
<MathVariable VARIABLENAME="MonthsEffective" TYPE="FUNCTION" DATATYPE="INTEGER">CalendarMonthsDiffOf(ActivityEffectiveDate,PolicyIssueDate)</MathVariable>
<MathVariable VARIABLENAME="YearsInEffect" TYPE="EXPRESSION" DATATYPE="INTEGER">MonthsEffective / 12</MathVariable>
<MathVariable VARIABLENAME="SurrenderCharge" TYPE="FUNCTION" DATATYPE="CURRENCY">ToCurrency(0,"USD")</MathVariable>
<MathIF IF="YearsInEffect < 7">
<MathVariable VARIABLENAME="SurrenderCharge" TYPE="EXPRESSION" DATATYPE="CURRENCY">(7 - YearsInEffect) / 100.0 * Activity:Amount</MathVariable>
</MathIF>
<MathVariable VARIABLENAME="TotalWithdrawal" TYPE="EXPRESSION" DATATYPE="CURRENCY">Activity:Amount + SurrenderCharge</MathVariable>
<MathVariable VARIABLENAME="NegSurrenderCharge" TYPE="EXPRESSION" DATATYPE="DECIMAL">-ToDecimal(SurrenderCharge)</MathVariable>
<MathVariable VARIABLENAME="NegWithdrawal" TYPE="EXPRESSION" DATATYPE="DECIMAL">-ToDecimal(Activity:Amount)</MathVariable>
<MathVariable VARIABLENAME="PolicyCashValue" TYPE="FIELD" DATATYPE="DECIMAL">Valuation:Policy:CashValue</MathVariable>
<MathVariable VARIABLENAME="AmountDecMV" TYPE="FUNCTION" DATATYPE="DECIMAL">ToDecimal(Activity:Amount)</MathVariable>
<MathVariable VARIABLENAME="MaxWithdrawalAmount" TYPE="EXPRESSION" DATATYPE="DECIMAL">PolicyCashValue</MathVariable>
<MathIF IF="Activity:WithdrawalType = '01'">
<MathVariable VARIABLENAME="MaxWithdrawalAmount" TYPE="EXPRESSION" DATATYPE="DECIMAL" ROUND="2">PolicyCashValue * .7 - ToDecimal(SurrenderCharge)</MathVariable>
</MathIF>
<MathVariable VARIABLENAME="MaxWithdrawalAmountTxt" TYPE="FUNCTION" DATATYPE="TEXT">ToText(MaxWithdrawalAmount)</MathVariable>
<MathVariable VARIABLENAME="PolicyCashValueTxt" TYPE="FUNCTION" DATATYPE="TEXT">ToText(PolicyCashValue)</MathVariable>
</MathVariables>
<Assignment TYPE="GrossFullWithdrawal">
<MoneyType NAME="NegSurrenderCharge">07</MoneyType>
<MoneyType NAME="NegWithdrawal">32</MoneyType>
</Assignment>
</Math>
</Transaction>"