MathLoop Element
The MathLoop math variable provides a method of executing a set of instructions that are to be repeated. Each type of repetition is called iteration. There are four types of Loops currently supported in
-
Configure a MathLoop that is TYPE="FOR" (allows the system to repeat instructions to loop for a specified number of iterations. The number of iterations can be specified by using a hard-coded integer value or a defined Math variable. If a Math variable is used the Math variable can calculate the amount of needed integers).
-
Configure a MathLoop that is TYPE="SEGMENT" (allows the system to loop through segments listed on/for a specific policy/certificate. By default, the SEGMENTLOOP will loop through all segments, inactive as well as active, unless the Math variable property for Condition is populated/configured. The Condition attribute/property is typically used to instruct the system to only loop through active segments).
-
Configure a MathLoop that is TYPE="OBJECT" (provides a method to loop through any
OIPA database table. OBJECT and OBJECTFIELD Math variables are used inside the OBJECTLOOP to set up the table to be looped through, then retrieve the values from the table). - Configure a MathLoop that is TYPE="VALUATION" (provides a method to loop through the values of Valuation records held in memory as the activity processes but before it is written to the database tables).
Important: Valuation Loop is only used with PostAssignmentValidateExpressions Business Rule).
TYPE=MATHLOOP | ||||
---|---|---|---|---|
Element | Attribute | Attribute Value | Element Value | Definition |
<MathLoop> |
TYPE |
OBJECTLOOP |
Configuration for statements that are repeatedly executed for each object in the collection. |
|
OBJECTNAME |
Name of the object where the data resides. This coincides with a database table. |
This is the table that is being used for the loop without the As, for example Client should be used for AsClient. |
||
KEY |
Column name that is the key for the database table referenced in OBJECTNAME. |
|
||
EFFECTIVEDATE | Optional Attribute - To Specify the AsOFDate to retrieve the correct time slice record of a time sliced entity | System Date | SystemDate is considered as default option for EffectiveDate attribute | |
CONDITION |
A string value that must be compatible with the SQL predicate used to retrieve the object data. |
|||
CONTEXT | "MATH" |
Optional Element: IF CONTEXT="MATH" would load the objects from context map without a database operation to fetch the required data. IF CONTEXT="MATH" is not used then required data would be fetched from database. |
Note :This attribute would be used to differentiate if it is for illustration request or for general use. CONTEXT="MATH" would specify that it would be used for illustration where all the input objects extracted from request xml are stored into Context map for math calculation rather than retrieving from database at runtime. For illustration requests CONDITION attribute would be ignored. | |
TYPE | FOR | Setting up the number of times the system will go through the loop configuration. The value may be a hard-coded literal value, a previously defined Math Variable of the Integer Data Type. | ||
ITERATIONS | Integer Value or Math Variable containing the Integer Value. | The number of times to go through the loop. | ||
TYPE | SEGMENT | To loop through segments on a policy or certificate. By default the segment will loop through all segments, inactive as well as active, unless a condition specifically references which Segments are applicable for the loop. | ||
CONDITION | Condition to evaluate. | Used to instruct the system which segments to loop through. | See operators for more details. Allows for the filtering of segments as you may only want to loop through active segments for example. | |
POLICY: | '[Policy:PolicyGUID'] | Required for every Segment MathLoop. | Always the same value noted. | |
TYPE | VALUATION | Provides a method for looping through a dynamic number of valuation records calculated per fund for each transaction. Filtering should be available based on FundGUID so that you are looping through Valuation records for a specific Fund. | ||
<MathVariable> |
|
|
||
<MathIF> |
|
See MathIF Element. |
||
<MathLoop> |
|
|
Note: This element is used only in ScreenMath. |
XML Example
<MathLoop VARIABLENAME="Segments" TYPE="SEGMENT" STATUS="01" POLICY="[Policy:PolicyGUID]">
<MathVariable VARIABLENAME="CurrentIndex" TYPE="LOOPINDEX" SOURCEARRAY="Segments" DATATYPE="INTEGER"></MathVariable>
<MathVariable VARIABLENAME="SegmentGUID" TYPE="SEGMENTFIELD" SOURCEARRAY="Segments" DATATYPE="TEXT">SegmentGUID</MathVariable>
<MathIF IF="CurrentIndex=0">
<MathVariable VARIABLENAME="SegmentPremPayEndDate" TYPE="COLLECTION" OPERATION="CREATE" DATATYPE="MAP"></MathVariable>
<MathVariable VARIABLENAME="SegmentPremPayStartDate" TYPE="COLLECTION" OPERATION="CREATE" DATATYPE="MAP"></MathVariable>
<MathVariable VARIABLENAME="SegmentWaiverStatus" TYPE="COLLECTION" OPERATION="CREATE" DATATYPE="MAP"></MathVariable>
</MathIF>
<MathVariable VARIABLENAME="TypeCode" TYPE="SEGMENTFIELD" SOURCEARRAY="Segments" DATATYPE="TEXT">TypeCode</MathVariable>
<MathIF IF="TypeCode='35'">
<MathVariable VARIABLENAME="SegmentPremPayEndDate" TYPE="COLLECTION" OPERATION="SETVALUE" KEY="SegmentGUID" DATATYPE="DATE">Activity:EffectiveDate</MathVariable>
<MathVariable VARIABLENAME="SegmentPremPayStartDate" TYPE="COLLECTION" OPERATION="SETVALUE" KEY="SegmentGUID" DATATYPE="DATE">DisabilityStartDateMV</MathVariable>
<MathVariable VARIABLENAME="SegmentWaiverStatus" TYPE="COLLECTION" OPERATION="SETVALUE" KEY="SegmentGUID" DATATYPE="TEXT">WaivingPremiums</MathVariable>
</MathIF>
</MathLoop>
<MathLoop VARIABLENAME="VariableName" TYPE="OBJECTLOOP" OBJECTNAME="TableName" EFFECTIVEDATE="DateVariable" CONDITION="Conditional Statement"KEY="GUID"></MathLoop>