LOOKUP Extension Method

LOOKUP Function

Template Functions can be used to ‘program’ the template output through writing functions. The LOOKUP function could be very useful to create a custom field based using data from a variety of other fields or a lookup table.

Example: 

There is a custom field that needs to use the lookup list “Department List Test” for the output value.

The formula below means that for “department” custom field value, the system will look at the lookup list “Department List Test” and replace output for that field. Depending on your field mapping within your channel template, then this is the value that will be sent.

LOOKUP(Department List Test,{Product.CustomFields[department]})

In this formula, 

department field is the custom field and in the formula, it must exactly match the field name as created in StoreAutomator. 

mceclip0.png

Department List Test is the replacement / lookup list name that contains the replacement value and in the formula, it must be typed exactly the same as created in StoreAutomator and must match. (Please see below how to add replacements / lookup lists in StoreAutomator.)

mceclip1.png

Depending on the value of the “department” custom field, it will look at the chosen lookup list (in this case it is called Department List Test) and take the result according to the value in the look up list. So, rather than sending department value “boys”, you will be sending the lookup list replacement value for the mapped field, which is “Toddler Boys” in this example.

mceclip2.png

Please refer to the article called Template Functions and Syntax for function writing guidelines.

Note: Please keep in mind that this is only an example; you must use valid values in accordance with the channel specifications and requirements.

Adding Replacements / Look up Lists:

In StoreAutomator, Replacements are also used as Look up Tables (aka Look up Lists). To add a look up list, you need to first click Replacements in the left navigation panel under the Settings then click the “+Add Replacement” button in the top right of the corner.

mceclip3.png
“Replacement Create” box will be popped up, as below.

mceclip4.png

Type the name of the  replacement / lookup list that you want to use.

Select a scope  - this can be either Free Text or Product Data. 

Free Text Option will only allow you to type as Free Text to convert a specific value.

mceclip5.png

Product Data Option will allow you to select Auto (dynamic replacement to be able to use  product data such as custom fields), Manual (for dynamic replacements by using formulas), and Free Text (for converting specific value). 

mceclip6.png

The rest of the specifications are exactly the same and this can be also done within the template fields.

Please refer to the article called Replacements for more information such as editing, using Match Case & Match Whole word function, Regex ,Normal & Extended Replacement Options. 

Important Note: Using the Lookup function within the formula will only use the “Stop” behavior, because it will look at the look-up list from Replacements, which has only one type behavior. So, in order to use the look-up list with “Continue” behavior, you must configure it within the template by editing the field.

Was this article helpful?

0 out of 0 found this helpful