codeRule action: Search for value

Used for: searching for a value in one field and then setting another field to this value if it is found.

Used in: "THEN"-statements and "ELSE"-Statements.

The "search for value" rule is useful when your export channel needs information such as "color", "brand" or "size" in a separate field, but that information is only present inside a larger field (for example, the item description). With the "search for value" rule you can look for a list of possible values (e.g., a list of colors) inside your descriptions. If Channable finds a value from that list, it can fill the chosen target field (for example, "color") with the found value. To fill another field such as "brand" instead, select the "brand" field as the target and provide a list of brands in the "Search value" list.

In the screenshot below the example described above is shown as it would look in Channable:

By default, the target field is set to the exact values typed in the "Search value" list. You can optionally provide a "replacement value" list to standardize or correct values (for example, to fix typos or different notations). When a search value is found, the corresponding replacement value on the same line will be used to fill the target field. Example usage is shown in the screenshot below:

circle-info

When using the "replacement value" list, make sure you enter a replacement value on the same line for every value in the "Search value" list. If you want to keep the same value as in the "Search value" list, fill in the same value in the "replacement value" list. Either fill the replacement list completely (matching the search list line-for-line) or leave it empty (which preserves the values in the "Search value" list).

List field

If the field you apply "search for value" to is of type list, the rule will be applied to every element in that list. When the list is empty, it will remain empty after applying this rule. If you instead want to convert an empty list to text before searching, add a rule to transform the list into text (for example, a "Join list" or similar) before the "search for value" rule. This transformation will automatically convert the field's type from 'list' to 'text' while preserving emptiness when appropriate.

Last updated

Was this helpful?