Three-and-a-Half New Functions from the Feed Doctor

May 4, 2012

Digital Marketing By ChannelAdvisor

TheFeedDoctorIt’s been a busy month for the Doctor. Besides attending Catalyst US (which was DYNAMITE), I also managed to write THREE new functions, plus an improvement to an old one. Here’s how it happened…

I was answering a business rule question on one of our forums when I realised we were missing two really handy functions: MAX and MIN. These functions accept two to eight numeric inputs and give you back the largest and smallest values, respectively. For example, MAX(2,1,8,4) would output 8, while MIN(2,1,8,4) would output 1.

One of our readers left a comment that inspired a change to the IFTOOLONG function. This function had three inputs: the “normal” text, a maximum length, and a “fallback” text. If the normal text is shorter than the maximum length, then the function outputs that. Otherwise, it outputs the fallback text. The problem is that sometimes the fallback text is also too long. So our reader suggested we allow the function to accept multiple fallback text values, and output the first one that’s not too long. This makes a lot of sense, so I made it so.

She also suggested we create a function that would truncate an input text so that it had no more than a given number of words. This is similar to the LEFTWORD function I wrote about a little while ago, only instead of the maximum total length, you specify the maximum number of words. I called this function NWORDS, and here’s an example:NWORDS(“The quick brown fox jumped over the lazy dog”,4,” ”)

Notice the “ “ after the 4. This is the delimiter between words; you could also use something else, such as a comma in a comma-separated list of words. In this example, the result would be “The quick brown fox”.

Look for these changes and more in our next software update!

Blog post by Anthony Alford, The Feed Doctor; Image courtesy of Zee Khan, Customer Support Manager

 

Comments are closed.