CodeGen Documentation
CodeGen Documentation

Relation Key Segment Loop Expansion Tokens

 

All key segment loop expansion tokens and field loop expansion tokens (for field segments) are available in Relation Key Segment Loops, and additionally the following tokens are available:

 

Token

Description

<LITERAL_SEGMENT_CSTYPE>

 

Inserts a string indicating the C# equivalent data type of a literal key segment of a foreign key that is referenced in the "from key" side of a relationship. Literal key segments defined in repository don't have a data type, only a value, so this token derives the data type by looking at the matching field segment in the relations associated "to key".

 

Possible values:  bool, byte, double, float, int, long, decimal, DateTime, Nullable<DateTime>, sbyte, short, string, uint, ulong, ushort

 

Example: Consider a relationship involving the following two structures and keys:

 

Structure A                                                  Structure B

FROM Foreign key                                        TO Access key

Segment 1, literal 0                                        Field rectype (D1)

Segment 2, field customer (D6)                    Field customer (D6)
 

In order to determine a data type for the literal segment in structure A, the code looks at the matching field segment in structure B. The field is a D1, so it will be represented as an int.

 

IMPORTANT NOTE: This token can ONLY be used in a relation FROM key segment loop, and further ONLY when processing a LITERAL segment, which can only exist in a FOREIGN key. The <IF SEG_TYPE_LITERAL> expression should be used to ensure this is the case. For example:

 

<RELATION_LOOP>

    <FROM_KEY_SEGMENT_LOOP>

        <IF SEG_TYPE_LITERAL>

            <LITERAL_SEGMENT_CSTYPE>

        </IF SEG_TYPE_LITERAL>

    </FROM_KEY_SEGMENT_LOOP>

</RELATION_LOOP>

 

 

<LITERAL_SEGMENT_SNTYPE>

 

Inserts a string indicating the Synergy .NET equivalent data type of a literal key segment of a foreign key that is referenced in the "from key" side of a relationship. Literal key segments defined in repository don't have a data type, only a value, so this token derives the data type by looking at the matching field segment in the relations associated "to key".

 

Possible values:  boolean, byte, double, float, int, long, decimal, DateTime, Nullable<DateTime>, sbyte, short, string, uint, ulong, ushort

 

Example: Consider a relationship involving the following two structures and keys:

 

Structure A                                                  Structure B

FROM Foreign key                                        TO Access key

Segment 1, literal 0                                        Field rectype (D1)

Segment 2, field customer (D6)                    Field customer (D6)
 

In order to determine a data type for the literal segment in structure A, the code looks at the matching field segment in structure B. The field is a D1, so it will be represented as an int.

 

IMPORTANT NOTE: This token can ONLY be used in a relation FROM key segment loop, and further ONLY when processing a LITERAL segment, which can only exist in a FOREIGN key. The <IF SEG_TYPE_LITERAL> expression should be used to ensure this is the case. For example:

 

<RELATION_LOOP>

    <FROM_KEY_SEGMENT_LOOP>

        <IF SEG_TYPE_LITERAL>

            <LITERAL_SEGMENT_CSTYPE>

        </IF SEG_TYPE_LITERAL>

    </FROM_KEY_SEGMENT_LOOP>

</RELATION_LOOP>

 

<LITERAL_SEGMENT_VALUE>

 

Inserts a string or numeric literal representing the value of a literal key segment of a foreign key that is referenced in the "from key" side of a relationship. Literal key segments defined in repository don't have a data type, only a value, so this token determines whether to insert a string or numeric literal by looking at the matching field segment in the relations associated "to key".

 

Possible values:

A numeric literal, e.g.          25

A string literal, e.g.                    "ABC"

Example: consider a relationship involving the following two structures and keys:

Structure A                                                  Structure B

FROM Foreign key                                        TO Access key

Segment 1, literal 0                                        Field rectype (D1)

Segment 2, field customer (D6)                    Field customer (D6)
 

In order to the type of literal value to insert  for the literal segment in structure A, the code looks at the matching field segment in structure B. The field is a D1, so a numeric literal value will be inserted.

 

IMPORTANT NOTE: This token can ONLY be used in a relation FROM key segment loop, and further ONLY when processing a LITERAL segment, which can only exist in a FOREIGN key. The <IF SEG_TYPE_LITERAL> expression should be used to ensure this is the case. For example:

<RELATION_LOOP>

    <FROM_KEY_SEGMENT_LOOP>

        <IF SEG_TYPE_LITERAL>

            <LITERAL_SEGMENT_VALUE>

        </IF SEG_TYPE_LITERAL>

    </FROM_KEY_SEGMENT_LOOP>

</RELATION_LOOP>

 

 

 


Copyright © 2021  Synergex International, Inc.