Soft coding literal values from Value table macros

The FTM model tooling allows the following FSM constructs to refer to configuration values {VALUE table data} in order to support soft coding of literal values or lists:
  • Event Filters
  • Object Filters
  • Object Selectors
Four macros are provided to reference configuration values.

Reference a single literal

$Value{<category>,<key>}

Replace instances of $Value{<category>,<key>} with the actual value from the lookup of VALUE table by category and key in the context of the correct application and version. If the Value table entry is not present or has a value of NULL, the macro substitutes the literal NULL.

Examples
Note: The following examples are not intended to be suggestive of best practice, they are purely intended to technically demonstrate the concept.
Category Key Value
THRESHOLD NO_AUTHORIZE_LIMIT 1000

Event Filter

$ContextGT{AMOUNT, $Value{THRESHOLD,NO_AUTHORIZE_LIMIT}}

=> $ContextGT{AMOUNT, 1000}

Object Filter

P.AMOUNT > $Value{THRESHOLD,NO_AUTHORIZE_LIMIT}

=> P.AMOUNT > 1000

Object Selector

SELECT ID FROM $DBSchema.PAYMENT_V AS P WHERE P.AMOUNT > $Value{THRESHOLD,NO_AUTHORIZE_LIMIT} AND STATUS=?

=> SELECT ID FROM $DBSchema.PAYMENT_V AS P WHERE P.AMOUNT > 1000 AND STATUS=?

Reference a single text literal

$ValueTxt{<category>,<key>}

This macro works the same as the $Value{} macro except that the literal value is quoted with single quotes.

Examples
Note: The following examples are not intended to be suggestive of best practice, they are purely intended to technically demonstrate the concept.
Category Key Value
ACK_TYPE ACK_OK ACK
ACK_TYPE ACK_FAIL NAK

Event Filter

$ContextEQ{OBJ_CLASS, $ValueTxt{ACK_TYPE,ACK_OK}}

=> $ContextGT{OBJ_CLASS, 'ACK'}

Object Filter

T.OBJ_CLASS = $ValueTxt{ACK_TYPE,ACK_OK}

=> T.OBJ_CLASS = 'ACK'

Object Selector

SELECT ID FROM $DBSchema.TRANSACTION_V AS T WHERE T.OBJ_CLASS = $ValueTxt{ACK_TYPE,ACK_OK} AND STATUS=?

=> SELECT ID FROM $DBSchema.TRANSACTION_V AS T WHERE T.OBJ_CLASS = 'ACK' AND STATUS=?

Reference a literal list

$ValueList{<category>,<value>}

Replaces instances of $Value{cat,value} with a list of key(s) from the lookup of VALUE table by category and value in the context of the correct application and version. If the lookup results in no hits, the macro is removed.

Examples
Note: The following examples are not intended to be suggestive of best practice, they are purely intended to technically demonstrate the concept.
Category Key Value
TERMINAL_IDS 1 TERM_GRP1
TERMINAL_IDS 2 TERM_GRP1

Event Filter

$ContextIN{TERMINAL, ($ValueList{TERMINAL_IDS,TERM_GRP1})}

=> $ContextIN{OBJ_CLASS, (1, 2)}

Object Filter

It is not envisaged that this macro is a good fit for object filters.

Object Selector

It is not envisaged that this macro is a good fit for object selectors.

Reference a list of text literals

$ValueTxtList{<category>,<value>}

This macro works the same as the $ValueList{} macro except that the literal value(s) are quoted with single quotes.

The FTM Generic Model makes use of this macro in the Generic Outbound Transaction FSM.

Examples
Note: The following examples are not intended to be suggestive of best practice, they are purely intended to technically demonstrate the concept.
Category Key Value
CLASS_ALIAS CLASS1 OUT_CLASS
CLASS_ALIAS CLASS2 OUT_CLASS
CLASS_ALIAS CLASS3 OUT_CLASS

Event Filter

$ContextIN{OBJ_CLASS, ($ValueTxtList{CLASS_ALIAS,OUT_CLASS})}

=> $ContextIN{OBJ_CLASS, ('CLASS1', 'CLASS2', 'CLASS3')}

Object Filter

T.OBJ_CLASS IN($ValueTxtList{CLASS_ALIAS,OUT_CLASS})

=> T.OBJ_CLASS IN ('CLASS1', 'CLASS2', 'CLASS3')

Object Selector

SELECT ID FROM $DBSchema.TRANSACTION_V AS T WHERE T.OBJ_CLASS IN($ValueTxtList{CLASS_ALIAS,OUT_CLASS}) AND STATUS=?

=> SELECT ID FROM $DBSchema.TRANSACTION_V AS T WHERE T.OBJ_CLASS IN ('CLASS1', 'CLASS2', 'CLASS3') AND STATUS=?