You are here: Transaction Rules > Transaction Elements > Math Element > COLLECTION and KEY

Oracle® Insurance XML Configuration Guide Release 9.4.1.0 E23637_01

# COLLECTION and KEY

## Description

This math element can be used to create a COLLECTION, set the value of a math variable from an existing math variable or activity field, or execute a SQL statement that will return two result columns as a key-value pair. In the latter case, the first column is considered the key with the second column a value. A subsequent statement of type COLLECTIONVALUE is used to access the key to retrieve its associated value (see the last XML example).

COLLECTION and KEY Element/Attribute Table
TYPE=COLLECTION KEY=GUID
Element | Attribute | Attribute Value | Element Value
OPERATION="CREATE" |  |  |
<MathVariable> |  |  | Empty
VARIABLENAME | String: The name of the math variable. |
TYPE | COLLECTION |
OPERATION | CREATE Creates a COLLECTION MathVariable. |
DATATYPE | MAP |
OPERATION="SETVALUE" |  |  |
<MathVariable> |  |  | String: Refers to the name of a COLLECTION math variable created with OPERATION="CREATE".
VARIABLENAME | String: The name of the math variable whose value is set by this configuration. |
TYPE | COLLECTION |
OPERATION | SETVALUE Assigns a value to an existing or new math variable once the collection is created. Use a previously defined Math Variable or Activity Field to replace the value / |
DATATYPE | DATE TEXT INTEGER DECIMAL |
ROUND | Integer If DATATYPE="DECIMAL" |
KEY | The KEY indicates the type of value the configuror is using to map or insert into a new math variable name within the Collection. For example a SegmentGUID for a SegmentLoop to update the face amount or active code, a unique naming convention, or fund code. |
DEFAULT | String |
LOG | Yes: the result is stored in AsActivityMath table to be used by other activities. No: the result is not stored. This is the default behavior. |
OPERATION attribute omitted |  |  |
<MathVariable> |  |  | Option 1: One of the following: <SqlServer>[SqlStatement]</SqlServer> <Oracle>[SqlStatement]</Oracle> <DB2>[SqlStatement]</DB2> Option 2: [SqlStatement]
VARIABLENAME | String |
TYPE | COLLECTION |
DATATYPE | MAP |

## XML Examples

#### OPERATION="CREATE"

    <MathVariable VARIABLENAME="SegmentAnnPremiumAmt" TYPE="COLLECTION"

    OPERATION="CREATE" DATATYPE="MAP"/>

#### OPERATION="SETVALUE"

    <MathVariable VARIABLENAME="SegmentAnnPremiumAmt" TYPE="COLLECTION"

    OPERATION="SETVALUE" KEY="CurrentSegmentGUID" DATATYPE="CURRENCY">CurrentYearsAnnualPremiumUSD

    </MathVariable>

#### OPERATION attribute omitted

    <MathVariable VARIABLENAME="SegmentCollection" TYPE="COLLECTION" DATATYPE="MAP">

    SELECT Field.FieldName,

    CASE

    WHEN Field.FieldTypeCode = '02' THEN Field.TextValue

    WHEN Field.FieldTypeCode = '03' THEN CAST(Field.IntValue AS CHAR(10))

    WHEN Field.FieldTypeCode = '04' THEN CAST(Field.FloatValue AS CHAR(32))

    END

    FROM AsSegment

    JOIN AsSegmentName ON AsSegmentName.SegmentNameGUID = AsSegment.SegmentNameGUID

    AND AsSegmentName.TypeCode = '04'

    JOIN AsSegmentField Field ON Field.SegmentGUID = AsSegment.SegmentGUID

    AND Field.FieldName IN ('SegmentIssueGender',

    			'SegmentUWClass',

    			'SegmentTobaccoPremBasis',

    			'SegmentAmount',

    			'SegmentIssueAge')

    WHERE AsSegment.PolicyGUID = '[Policy:PolicyGUID]'

    </MathVariable>

COLLECTIONVALUE Example

    <MathVariable VARIABLENAME="BaseFace" TYPE="COLLECTIONVALUE"

    KEY="SegmentAmount" DATATYPE="DECIMAL" DEFAULT="-999999999">SegmentCollection

    </MathVariable>

## XML Schema

#### OPERATION="CREATE"

    <MathVariable VARIABLENAME="[String]" TYPE="COLLECTION"

    OPERATION="CREATE"

    DATATYPE="MAP">

    </MathVariable>

#### OPERATION="SETVALUE"

    <MathVariable VARIABLENAME="[String]" TYPE="COLLECTION"

    OPERATION="SETVALUE" KEY="[String]" DATATYPE="DATE|TEXT|INTEGER|DECIMAL"

    ROUND="[Integer]" DEFAULT="[String]" LOG="Yes">[String]

    </MathVariable>

#### OPERATION attribute omitted

    <MathVariable VARIABLENAME="[String]" TYPE="COLLECTION" DATATYPE="MAP">

    <!-- option 1 -->

    <SqlServer>[SqlStatement]</SqlServer>|<Oracle>[SqlStatement]</Oracle>|<DB2>[SqlStatement]</DB2>

    <!-- option 2 -->

    [SqlStatement]

    </MathVariable>

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

Open table of contents