Calculate
This business rule calculates various segment and policy values. When a segment is added to a policy, the math configured in this business rule takes into account various aspects of the policy and arrives at the values, which may be stored in the database tables. The standard naming convention for the rule is to attach a suffix to the rule name with a common name for the segment to which it is associated, such as CalculateGeneral-BaseCoverage. Calculate business rules are always identified by their <Calculate> parent element.
Note: You can create a plan override of a Calculate business rule for each segment. In the SegmentScreen business rule, associate the calculate button with a specific CalculateGeneral rule that is tailored to a specific segment.
- When the Calculate rule is executed, it first processes the <Input> element section. The <Input> element provides for the inclusion of <MathVariables>. Each <MathVariable> must be included inside this element in order for it to be used in any part of the Calculate rule.
- After completing the <Input>
section, the <Validation>
element section is processed. This section allows
for data validation.
It also processes substitution of the value of math variables or segment fields within validation messages at the time any message is generated. - The final section processed is the <Output> element section. This section provides a method of moving values to various database tables. The <Mappings> sub-element allows <MathVariables> calculated in the <Input> to be copied. In order for each <MathVariable> to be mapped, it must be included in this section regardless of its inclusion in the <Input> section. The Calculate rule will automatically update OptionText for combo box and radio button fields.
- By default, each <MathVariable>
that is mapped as a field is stored as a segment field in the AsSegmentField
database table. In order to store a <MathVariable>
as a segment field it must be included as a field in the specific segment's
segment name business rule. If the value should
not be displayed for the end user in
OIPA , then the Hidden attribute of the <Field> element must be used in the segment business rule to hide the field. - If a <MathVariable> needs to be stored in a table other than Segment, such as a policy field in the AsPolicyField table, then it must be specified. The GROUP attribute of <Mapping> allows for the specification of the table the fields should be stored in. In this secenario, GROUP would be set to Policy.
- Specific values from the database can be retrieved without writing SQL statements, by using the available defined prefixes and fields for configuration. Please see the Available Prefixes and Fields for Configuration for a listing.
Element/Tag | Attribute | Definition | Element/Attribute Value and Description |
---|---|---|---|
<Calculate> |
|
The opening and closing tag of the Calculate business rule. |
|
<Input> |
|
The opening and closing tag that contains the MathVariables for the rule. |
|
<MathVariables> |
|
Please see MathVariable Elements. |
|
<MathVariable> |
|
|
|
<MathIF> |
|
Please see MathIF Elements. |
|
<MathLoop> |
|
Please see MathLoop Elements. |
|
<CopyBook> |
|
Please see CopyBook Rule. |
|
<Validation> |
|
||
<Expression> |
An expression using MathVariables and operators. Allows validation of the values contained in MathVariables. See Validation for full details. |
String |
|
TYPE |
|
ErrorOnTrue ErrorOnFalse |
|
MESSAGE |
The error message to be displayed to the user.
|
String |
|
<Output> |
|
Identifies the values that were calculated and will be written to the database. |
|
<Mappings> |
|
Starting tag that identifies which MathVariable will be mapped. |
|
<Mapping> |
Identifies the MathVariable with the value that will be copied to the database table. The value identifies the Math Variable. |
||
OUTPUTNAME |
Defines the name of the field that will be updated. |
String |
|
TYPE |
Always specify a value of "FIELD". |
String |
|
GROUP |
Identifies the table to which the data will be saved. |
Segment: The data will be saved to the AsSegment database table. This is the default behavior. Policy: The data will be saved to the AsPolicy database table. |
|
ROLEGUID | |||
ROLEGUIDARRAY | |||
DEFAULT | |||
<BenefitSplit> |
|
Optional element Defines Benefit Split parameters for calculations. Note: The precision of the resulting BenefitSplit units will be set by the Plan’s AllocationScreen rule using the Policy level settings. |
|
<Allocations>
|
|
Required element Selects the allocation from which the benefit split will be built. |
|
TYPECODE |
Holds a literal or variable indicating the Allocation Type Code to merge. |
|
|
LEVEL |
Holds a literal or a Policy/Plan variable indicating the level of the type code to merge. |
|
|
<MergeAllocations>
|
|
Optional element Controls choosing the fixed fund allocations outside of the Allocation Screen. |
|
MERGE |
Holds a literal or variable (Yes/No) indicating if merge logic is required. |
Yes | No No is the default value. |
|
<AddAllocations>
|
|
Required if MERGE is 'Yes'. |
|
TYPECODE |
Holds a literal or variable indicating the Allocation Type Code to merge. |
|
|
LEVEL |
Holds a literal or a Policy/Plan variable indicating the level of the type code to merge. |
|
|
PERCENT |
Holds a literal or variable percentage of the allocation to be applied. The precision of the resulting merged allocations will be set by the Plan’s AllocationScreen rule using the Policy level settings |
|
|
<FinalAllocations>
|
|
Controls writing new AsAllocation records with the result of the merged allocations. Final Allocations are saved at the Segment level. |
|
TYPECODE |
Holds a literal or variable indicating the Allocation Type Code of the FinalAllocation AsAllocation record. |
|
|
<Relation> |
|
Required element Contains relation keys to link benefit funds to the parent/child allocations. |
|
<Criteria>
|
|
Required, repeatable element Identifies the fund field with which to match the Input Math value. The value of the Criteria is a Math Variable from the CalculateGeneral input math, or a literal value, for matching the criteria name. |
|
NAME |
Identifies the Fund Field. |
|
|
DATATYPE |
Specifies the data type of the criteria value and Fund Field. |
|
|
<FixedBenefitFund> |
|
Required if the segment supports fixed benefit payouts. The element holds a variable containing a fund type code 03 FundGUID to which all fund type code 01 fixed allocation(s) will merge. |
|
<EffectiveDate> |
|
Required element Holds a Math Variable date value used to look up the unit values of the benefit funds. |
|
<CreateDeferredSplit> |
|
Optional element Holds a Math Variable or literal value of Yes or No indicating if type 51 benefit split records are to be created. |
Yes | No No is the default value. |
<VariableBenefit> |
|
Required element Specifies a currency or decimal Math Variable representing the calculated variable benefit amount. The currency is assumed to be the Plan default. Note: Currently only used when 'Solve for Benefit' is selected. |
|
<FixedBenefit> |
|
Required element Specifies a currency or decimal Math Variable representing the calculated fixed benefit amount. The currency is assumed to be the Plan default. Note:Currently only used when 'Solve for Benefit' is selected. |
|
<GeneratePendingRequirements> |
Optional element |
Yes/No |
XML Examples
Calculate General Example
<Calculate>
<Input>
<MathVariables>
<!-- SegmentFields -->
<MathVariable VARIABLENAME="True" TYPE="VALUE" DATATYPE="INTEGER">1</MathVariable>
<MathVariable VARIABLENAME="False" TYPE="VALUE" DATATYPE="INTEGER">0</MathVariable>
<MathVariable VARIABLENAME="GMDBEffectiveDate" TYPE="SEGMENTFIELD" DATATYPE="DATE">StartDate</MathVariable>
<!-- Clients On Policy DOB Collection -->
<MathVariable VARIABLENAME="AnnuitantExists" TYPE="SQL" DATATYPE="INTEGER" DEFAULT="-999999999">
SELECT (CASE WHEN COUNT(*) > 0 THEN 1 ELSE 0 END)
FROM AsCode JOIN AsRole ON AsRole.PolicyGUID = '[Policy:PolicyGUID]'
AND AsRole.RoleCode = AsCode.CodeValue WHERE AsCode.CodeName = 'AsCodeRole'
AND AsRole.RoleCode='27'</MathVariable>
<MathVariable VARIABLENAME="AnnuitantDOB" TYPE="SQL" DATATYPE="DATE">
SELECT AsClient.DateOfBirth FROM AsCode LEFT JOIN AsRole
ON AsRole.RoleCode = AsCode.CodeValue AND AsRole.PolicyGUID = '[Policy:PolicyGUID]'
LEFT JOIN AsClient ON AsClient.ClientGUID = AsRole.ClientGUID
WHERE AsCode.CodeName = 'AsCodeRole' AND AsCode.CodeValue = '27'</MathVariable>
<MathVariable VARIABLENAME="AnnuitantDOBExist" TYPE="FUNCTION" DATATYPE="BOOLEAN">IsEmpty(AnnuitantDOB)</MathVariable>
<MathIF IF="AnnuitantDOBExist=false">
<MathVariable VARIABLENAME="AnnuitantAgeMV" TYPE="FUNCTION" DATATYPE="INTEGER">ANBAgeOf(AnnuitantDOB,GMDBEffectiveDate)</MathVariable>
</MathIF>
<MathVariable VARIABLENAME="GMDBMaximumAgeMV" TYPE="PLANFIELD" DATATYPE="INTEGER">GMDBMaximumAge</MathVariable>
</MathVariables>
</Input>
<Validation>
<Expression TYPE="ErrorOnTrue" MESSAGE="Annuitant Date of Birth is blank.">
IsEmpty(AnnuitantDOB) And AnnuitantExists > 0</Expression>
<Expression TYPE="ErrorOnTrue" MESSAGE="Annuitant must be of age 70 or less.">
AnnuitantAgeMV > GMDBMaximumAgeMV</Expression>
</Validation>
<Output>
<Mappings>
<Mapping OUTPUTNAME="AnnuitantAge" TYPE="FIELD" GROUP="Segment">AnnuitantAgeMV</Mapping>
</Mappings>
</Output>
<GeneratePendingRequirements>No</GeneratePendingRequirements>
</Calculate>
Calculate Benefit Split Example
<Calculate>
<Input>
<MathVariables>
<MathVariable VARIABLENAME="PolicyBandVariable" TYPE="POLICYFIELD" DATATYPE="TEXT">BandVariable</MathVariable>
<MathVariable VARIABLENAME="BenefitSplitBand" TYPE="SEGMENTFIELD" DATATYPE="TEXT">BenefitSplitBand</MathVariable>
<MathVariable VARIABLENAME="UnitValueDate" TYPE="SEGMENTFIELD" DATATYPE="DATE">BenefitValuationDate</MathVariable>
<MathVariable VARIABLENAME="DeferredSplit" TYPE="SEGMENTFIELD" DATATYPE="TEXT">DeferredSplit</MathVariable>
<MathVariable VARIABLENAME="VariableBenefitAmount" TYPE="SEGMENTFIELD" DATATYPE="DECIMAL">VariableBenefitAmount</MathVariable>
<MathVariable VARIABLENAME="FixedBenefitAmount" TYPE="SEGMENTFIELD" DATATYPE="DECIMAL">FixedBenefitAmount</MathVariable>
<MathVariable VARIABLENAME="TotalBenefitAmount" TYPE="EXPRESSION" DATATYPE="DECIMAL">VariableBenefitAmount + FixedBenefitAmount</MathVariable>
<MathVariable VARIABLENAME="TotalBenefitAmountCurrency" TYPE="FUNCTION" DATATYPE="CURRENCY">ToCurrency(TotalBenefitAmount,'USD')</MathVariable>
<MathVariable VARIABLENAME="FixedBenefitFundGUID" TYPE="SQL" DATATYPE="TEXT">
SELECT AsFund.FundGUID FROM AsPlanFund
JOIN AsFund ON AsFund.FundGUID = AsPlanFund.FundGUID
AND AsFund.TypeCode = '03' AND AsFund.FundName = 'Dynamic Fixed'
WHERE PlanGUID = '[Policy:PlanGUID]'</MathVariable>
<MathVariable VARIABLENAME="MergeAllocations" TYPE="SEGMENTFIELD" DATATYPE="TEXT">MergeAllocations</MathVariable>
<MathVariable VARIABLENAME="MergePercent" TYPE="SEGMENTFIELD" DATATYPE="DECIMAL">MergePercent</MathVariable>
<MathVariable VARIABLENAME="AllocationTypeMV" TYPE="SEGMENTFIELD" DATATYPE="TEXT">AllocationType</MathVariable>
</MathVariables>
</Input>
<Output>
<Mappings>
<Mapping OUTPUTNAME="SegmentAmount" TYPE="FIELD">TotalBenefitAmountCurrency</Mapping>
</Mappings>
</Output>
<BenefitSplit>
<Allocations TYPECODE="AllocationTypeMV" LEVEL="Policy">
<MergeAllocations MERGE="MergeAllocations">
<AddAllocations TYPECODE="01" LEVEL="Plan" PERCENT="MergePercent">
<FinalAllocations TYPECODE="05"/>
</AddAllocations>
</MergeAllocations>
</Allocations>
<Relation>
<Criteria NAME="BandVariable" DATATYPE="TEXT">PolicyBandVariable</Criteria>
<Criteria NAME="InvestmentRate" DATATYPE="TEXT">BenefitSplitBand</Criteria>
<FixedBenefitFund>FixedBenefitFundGUID</FixedBenefitFund>
</Relation>
<EffectiveDate>UnitValueDate</EffectiveDate>
<CreateDeferredSplit>DeferredSplit</CreateDeferredSplit>
<VariableBenefit>VariableBenefitAmount</VariableBenefit>
<FixedBenefit>FixedBenefitAmount</FixedBenefit>
</BenefitSplit>
</Calculate>
XML Schema
<Calculate>
<Input>
<MathVariables />
</Input>
<Output>
<Mappings />
</Output>
<BenefitSplit>
<Allocations TYPECODE="[CodeValue]" LEVEL="[Policy, Plan]">
<MergeAllocations MERGE="">
<AddAllocations TYPECODE="[CodeValue]" LEVEL="[Policy, Plan]" PERCENT="">
<FinalAllocations TYPECODE="[CodeValue]"/>
</AddAllocations>
</MergeAllocations>
</Allocations>
<Relation>
<Criteria NAME="" DATATYPE="" />
<FixedBenefitFund />
</Relation>
<EffectiveDate />
<CreateDeferredSplit />
<VariableBenefit />
<FixedBenefit />
</BenefitSplit>
<GeneratePendingRequirements>[Yes|No]</GeneratePendingRequirements>
</Calculate>