The Data Calculator can perform lookups on attribute level. The lookup data has to be provided at special lookup ports.
To add a lookup port to a Data Calculator component, connect the output port of the data providing component with the Data Calculator component. Or, you can select Add Input Port from the Data Calculator component menu and connect the output port of the data providing component with the new port.
The number of lookup ports is unlimited.
Each lookup port must have at least two attributes. The first attribute represents the key, all other attributes the return values.
If you need to lookup compound keys you have to concatenate the key values within a preceding component and use the same kind of concatenation on the key expression for the lookup.
You can use the Lookup Options property to configure the lookup. The Enter Property window will display a list of all lookup ports and its current option values.
The properties are:
Lookup Name — The Lookup name is inherited from the associated port and cannot be changed here. To change a name of a port, select Description from the port menu.
Lookup Size — Enter the estimated number of lookup records to optimize memory allocation and lookup performance (this option is described more detail in “DB Lookup component”).
Lookup Empty / Null — Empty and Null are normally handled as “unknown” keys, thus returning the lookup default value. If Empty or Null values are valid keys for your lookup, you can enforce looking up the values for these keys by activating the appropriate options.
To set up Lookup rules open the Tabular Tab of the Data Calculator window. If Lookup ports are available an additional Lookup column is displayed.
You must provide the following information for each lookup rule:
Key Expression — This is the value to search for in the first column of the lookup list. You enter the key expression (for example IN.PR_ID) as the Transformation Rule.
Return Value — Since lookup lists can have more than one return value columns you have to specify which value to return, if the key has been found. This is done by selecting the associated port attribute from the pop-up menu on the Lookup column (for example LOOKUP1>>LOOKUP1.PR_NAME).
Although the return values are selected and displayed by name, the lookup internally uses the column number. This means you will need to review your lookup rules whenever the lookup port structure is modified, especially after adding or removing attributes.
The key column is always returned as Unicode.
Output Variable — The Lookup return value is assigned to this variable. You can select a variable from the pop-up menu on the Output Port column (for example, OUT>>OUT.PR_NAME).
Default Expression (optional) — A Lookup will return Null if the given key value is not found. To return a different default value you can enter an expression in the Lookup Options window (for example, “key not found”).
Without Lookups, there is no impact on a simulation sequence. With Lookups, all data is read into the Lookup ports before the data at the Main port is processed.