The Feed Doctor on Another New Function
Time to follow up on my teaser post from last time. By the way, I found out that not everybody is aware that sometimes my posts are kind of long, so their complete text isn’t always on the main blog page. If you ever see a little bitty “(more…)” toward the end of the post, that means you need to click on the “(more…)” to read the full post. Today is no exception…(this is your cue to click on “(more…)”)
Let’s say you knew that in all your item titles, you want to do the following:
- Replace “Big” with “Huge”
- Replace “Drinking Glass” with “Tumbler”
- Replace “Faucet” with “Water Dispenser”
- Replace “Light Bulb” with “Luminous Spheroid”
Before this past weekend, you would have to write a business rule that looks something like this:
REPLACE(REPLACE(REPLACE(REPLACE($offername,"Light Bulb","Luminous Spheroid"),"Faucet","Water Dispenser"),"Drinking Glass","Tumbler"),"Big","Huge")
Nasty. And what happens when you have a dozen or so phrases you want to replace? It would be so much simpler if you could put your search-and-replace text into a lookup list, then call one function that searches for all the “names” in the list and replaces each with its corresponding “value.” And now you can!
First, let’s define our list.

Next, the business rule. Here’s where we use the new function, REPLACEWORDLIST. This has two parameters: the name of the list and the text to do the search/replace on.

Much nicer, eh? Finally, the rule will of course do nothing until it’s used in a template. Obviously we want its output to go in the title or “Product Name” field in our output.

Done and done. Here are some sample input and output titles:
| Example # | Original Title | Output Title (From Rule) |
|---|---|---|
| 1 | Bronze Faucet | Bronze Water Dispenser |
| 2 | Energy Saving Light Bulb Fixture | Energy Saving Luminous Spheroid Fixture |
| 3 | Big Red Drinking Glass | Huge Red Tumbler |
Remember, we created this function to help a reader solve a problem he was having. If you’d like me to help simplify your ShoppingAdvisor business rules, just leave a comment here and I’ll see what I can do.
