The Feed Doctor Unveils a New Business Rule Function: JOINNB

April 9, 2012

Digital Marketing ChannelAdvisor By ChannelAdvisor

We’ve got quite a few business rule superstars here at ChannelAdvisor. I was talking to two of them, Alisyn Collins and Carol Scheible, about a rule they had written. They had used JOIN to splice together a bunch of fields with a delimiter between them. But some of the fields were blank sometimes, so they had extra delimiter characters they had to get rid of. To fix this, they were using a pretty scary regular expression. They suggested that we needed a new function:

“What we really need is a join that skips blanks, so you don’t end up with duplicate delimiters in the first place.”

This was definitely a facepalm moment on my part: of course we need a function for this! You might even argue that that’s the way JOIN ought to work by default. But since it’s kind of risky to change the behaviour of things that aren’t, strictly speaking, broken, I decided to make this a new function. I let Carol and Alisyn pick the name: JOINNB. The “NB” is for “no blanks.”

Here’s an example of how it works. Let’s say that $sku is “ABC,” $brand is blank, and $mpn is “123.”

If you wrote this rule:

you’d get this output:

But if you use the new function:

you get this:

This new function will ship with the April release, just in time for Catalyst. Speaking of Catalyst: I’ll be there myself, so if you get a chance, come by and say hello!

Blog post by Anthony Alford, The Feed Doctor.