Explore Categories

 

 PDF

Key Value Map

The objective of this capability to improvise the performance during the search index. Key Value Map has been introduced to provide the capability of faster searching the value from the list of values and evaluate the corresponding expression if the search matches, thus improvising the performance drastically.

Definition – Key Value Map

The definition enables developers to define a list of key-value pairs, to optimise search values.

Attributes

Use / Add / Delete

Attribute modifiers have been extended for ‘Key Value Map’ definition also.

Key Type

The attribute is to identify the type of key. This will determine how to interpret the key value. This is a mandatory value. The absence of the value or wrong value will result in error. Currently, four types are allowed as below :

  1. Sys Id
  2. Error Id
  3. String
  4. Long

Syntax

[Key Value Map : <>]

Key Type  : <Sys Id/Error Id/String/Long>

Example

[Key Value Map : GSTPLT IndiaStateCode]

Key Type   : Sys Id

Key Value

The attribute is to specify the list of keys and corresponding expressions. The Key will be unique and depend on the ‘Key Type’ specified. If the same key value is specified more than once, then the last one will be picked up. The attribute expects two parameters, and both are mandatory. However, a ‘Key Value’ or ‘Key’ attribute can be specified in a definition. If both ‘Key’ and ‘Key Value’ attributes are specified, the system will throw debug errors as the definition can have either list of key-value pairs or only a list of keys.

Syntax

[Key Value Map : <>]

Key Type  : <Sys Id/Error Id/String/Long>

Key Value : <Key value>    : <TDL Expression>

Example

[Key Value Map : GSTPLT IndiaStateCode]

Key Type   : Sys Id

Key Value  : AndamanNicobarIslands     : “35”

Key Value  : AndhraPradesh             : “37”

Key Value  : ArunachalPradesh          : “12”

Key Value  : Assam                     : “18”

Key

The attribute is to specify the list of keys where a search needs to be done. If the ‘Key Type’ is ‘Sys-Id’  in that case the system name is specified, if the ‘Key Type’ is ‘Error Id’ in that case error name is specified and for string values, the const string should be specified in quotes. However, a ‘Key Value’ or ‘Key’ attribute can be specified in a definition. If both ‘Key’ and ‘Key Value’ attributes are specified, the system will throw debug errors as the definition can have either list of key-value pairs or only a list of keys. The ‘Key’ attribute has precedence over the ‘Default’ attribute.

Syntax

[Key Value Map : <>]

Key Type  : <Sys Id/Error Id/String/Long>

Key       : <Key value>

Example

[Key Value Map : GSTPLT PartyRegType]     

Key Type   : Sys Id
Key : Regular
Key : Composition
Key : GSTRegularSEZ
Key : DeemedExporter
Key : RegularExports

Default

The attribute is to specify a value in case none of the searches is matched. It is necessary to mention the ‘Default’ attribute to avoid any failures. The ‘Key’ attribute has precedence over the ‘Default’ attribute. If both the attributes are specified, then Default would be ignored.

Syntax

[Key Value Map : <>]

Key Type  : <Sys Id/Error Id/String/Long>

Key Value : <Key value>    : <TDL Expression>

Default   : <TDL Expression>

Example

[Key Value Map : GSTPLT IndiaStateCode]

Key Type   : Sys Id

Key Value  : AndamanNicobarIslands     : “35”

Key Value  : AndhraPradesh             : “37”

Key Value  : ArunachalPradesh          : “12”

Key Value  : Assam                     : “18”

Default    : ($$InitValue:String)

Functions

$$GetValueFromKeyValueMap

The function is used for the 2nd pattern where if the search is found then the function will evaluate the corresponding expression defined in the map in the current object context. If the search is not found, the function will use the default attribute.

Syntax

$$GetValueFromKeyValueMap: <Key Value Map definition Name> : <Expression which will result into key value>

$$IsKeyPresentInKeyValueMap

This function will be used for 1st pattern where we need to just if the expression value is present as a key in the map definition. If not found then it will return False else it will return True

Syntax

$$IsKeyPresentInKeyValueMap: <Key Value Map definition Name> : <Expression which will result into key value>

TallyHelpwhatsAppbanner
Is this information useful?
YesNo
Helpful?
/* */