Question karthikeyan Ramasamy · Jan 8, 2018

Extending Ens.Util.LookupTable

Is there any way to extend the lookup table to have more than one value against a key?

Comments

Craig Regester · Jan 10, 2018

While not truly extending Ens.Util.LookupTable, we have numerous cases where we have to handle multiple values against a single key. 

Our solution was to identify a special character we would use as a delimiter of values (say @ for instance) and store them as such: value1@value2

We then have a custom CoS function that we can use to perform the normal lookup functions that parses the values and returns them as an array object that we can then use to pull out the value we need.

If you are simply after a pair of values, then the CoS is not even needed as you could use the built-in Piece function to rip apart the values using the delimiter.

0
Eduard Lebedyuk  Jan 10, 2018 to Craig Regester

Store $lb maybe? Or is there some drawbacks?

0
Kurro Lopez · Jan 10, 2018

If you really need a double key, use a persistence class instead.

You can define your fields and the key you want. You only need one instance of the object and find using the index.

The Looup table  was designed to be used as a dictionary, do not try to use an object for another purpose.

Best regards

0