Inheritance value

Scope/Lifetime

Live in the profile (and not in other profiles) during the profile run/test.


Definitions


In contrast to a normal single value, an Inheritance Value provides up to 20 hierarchy levels (level 120). Level 1 (root) is the background, level 2 ranges before level 1, level 3 before level 2 and so forth. Each level can contain a single value. This data type only exists in the context of maps and cannot be used as a field or variable data type.

A single value can also be a value with a set Empty Flag. If the level is empty (no value has been saved at this level, see function "add to inheritance-map()") or the single value inside of this level has the Empty Flag set (levels containing a value with Empty Flag are treated as an empty level), then it is 'transparent'.

Thus, the visible value is always the non-empty level ranking highest (on highest level). If all levels are empty or contain only values with a set Empty Flag, then the visible value is a string of length 0 ("") with a set Empty Flag. Every single value in a level is stored typified. Usually, the values of all the levels should be of the same type but this is not mandatory.

Relevant functions


So far, the Inheritance Values are relevant only when working with maps, in particular with the functions "add to inheritance-map()", "get value from map()" and "remove from map()". The complete inheritance value with all levels is included in the Named Map under the specified key a, exactly like a normal single value.

A single value b can be added to a specified level d by using function "add to inheritance-map()". Adding values to the same level of the same Inheritance Value repeatedly will lead to replacing the previous value of this level, even if the new value is an empty value. If parameter d is not set, then root level (level 1) is used as default level.

Inheritance value versus normal single value


If the Named Map c already contains a normal single value under key a, then calling function "add to inheritance-map()" will lead to storing this existing value in level 1 of the new Inheritance Value. If the Named Map c already contains an Inheritance Value under key a, only the single value in level d will be inserted and thereby replace the old one. Levels of an Inheritance Value that have never been assigned do not use memory.

If the named map c already contains an Inheritance Value under key a, adding a normal simple value under key a using the function add to map() will lead to the loss of the Inheritance Value (including all levels), which will be replaced by the new single value.

Deleting inheritance values


There is no function to delete a value from a specific level of the Inheritance Value. Store a value with a set Empty Flag to the level if you want to make this previously used level 'transparent'. To do so, it is sufficient if value b matches the regular expression e. This is done e.g. by specifying b = X and e = X, or with b = <anything> and e = .*

The scope of inheritance values


In an EDIFACT or SAP IDoc document, it is possible to use specifications with identical semantic meaning on different levels of the document, for instance in the header or on the item level. Usually, the following rule applies: If there is a value on the item level, then use this value. Otherwise, use the respective value on the header level. If neither on the header nor on the item level contains a value, it might be necessary to use a default value. In some special scenarios, sub-items beneath the items might be required, and so forth. Abstracting from the terms 'default', 'head', 'item' and 'sub-item', we need to represent different hierarchical levels on which semantically equivalent values need to be stored. These semantically equivalent values on different levels (with only the highest, non-empty level being the valid return value) can be stored in a named map as Inheritance Value.


The function "add to inheritance-map()" can also be used in order to mark a field or variable value with the Empty Flag and thus as non-existing (e.g. 0000). If value b matches the regular expression in parameter e, the function will set the Empty Flag for the value in b. Note: This evaluation logic can also be used independently of Inheritance Values by specifying value b and regex e in the function call and leaving the other parameters empty.