Lookup table with multiple criteria

Bronze Contributor
Bronze Contributor

The lookup table extension has a Lookup Match -> Output format, but what if I needed to match several variables? Should I use two extensions?

7 REPLIES 7

Lookup table with multiple criteria

Employee Emeritus

Hello @isaacc. If you have a set of variables that you need to combine, and then use to match. Use the Join Data Values extension ahead of the lookup table, and then match on the joined variable value(s).

Lookup table with multiple criteria

Tealium Employee

Hi @isaacc

I would post this into the new Product Ideas forum.
This is a perfect candidate.

Regards,

Adrian

Ask me anything Tealium related or TypeScript/JavaScript, or NodeJS.
Please remember to mark solutions as accepted for future searchers.

Lookup table with multiple criteria

Gold Contributor
Gold Contributor

I have a similar situation where I have to look up for a value in multiple variables. It might be present in variable1 on certain pages and in variable2 for certain pages. 

Irrespective of where the value was, I want to assign that value to a new UDO using look up table. This is currently not possible.

ksugam

Lookup table with multiple criteria

Tealium Employee

@ksugam

In this case, I'd use 2 extensions prior to the lookup table.

  1. Create a new data attribute, e.g. myLookup
  2. Create a new Set Data Values extension that sets myLookup to variableA if variableA exists
  3. Create a new Set Data Values extension that sets myLookup to variableB if myLookup is not defined and is not populated, and if variableB exists (this ignores using variableB so that variableA takes precedence, but you can setup up the condition how you like)
  4. Then do the lookup extension that looks up against myLookup

What this does is allow you to pre-process using variableA or variableB, yet still do a single lookup table. 

Cheers,
-Dan

Lookup table with multiple criteria

Gold Contributor
Gold Contributor

Thanks @dan_george

I still feel this won't be a scalable solution as we will need to add extensions for each variable. 

What I feel can be added to the Lookup table is the following-

Look up value in set of variables- Variable a, variable b, variable c, etc and then update myLookup variable if there is a match. This will save time in adding multiple set Data extensions before a Lookup extension. 

ksugam

Lookup table with multiple criteria

Tealium Expert
Tealium Expert

You don't need to use multiple extensions for multiple variables. Simply use a single one, and have it set "myVariable" to the following JS code:

b.myVariableA || b.myVariableB || b.myVariableC || b.myVariableD

Chain as many as you need, and the first defined value will be returned. So if you're dealing with naming convention problems across different parts of the site, you might do something like:

Set bestProductName to JSCode: b.productName || b.product_name || b.product

Without intending to be rude, it sounds like the problem isn't the way in which the lookup table extension works, it's the consistency of the data layer that's an issue here. Personally I would use extensions to try to arrive at a consistent data layer prior to performing any lookups, so that all downstream mappings etc. are working to a common definition (after all, the U in UDO stands for universal..).

Lookup table with multiple criteria

Gold Contributor
Gold Contributor

thanks @UnknownJ

Totally agree about the consistent UDO but I am working on an already existing project and hence have to perform hacks in order for things to work :)

Also, the scope of the values on different pages is different and hence captured in different UDOs depending on page type

ksugam
Public