Jump to content

Create this rule using Wizard (not Javascript)


DCurry

Recommended Posts

I know I can get this to work by finding some existing Javascript and cobbling it together, but I'm curious how I would accomplish this using the Rule Wizard for its drag-and-drop ease:

 

Data has field for "Name" and "Suffix" (Jr., Sr., III, etc.). The salutation needs to read "Dear John Doe Jr.," or "Dear Steve Smith," so my thinking is that the JS would read something like "if (suffix) == "" then return "," else return " " + (suffix) + ","

 

(I know that is not actual javascript language, but I'm just trying to illustrate without actually looking up the proper syntax.)

 

What I can't figure out in the wizard is how to put the space before the "suffix" field in the else line.

 

Thanks for any advice!

Link to comment
Share on other sites

I know I can get this to work by finding some existing Javascript and cobbling it together, but I'm curious how I would accomplish this using the Rule Wizard for its drag-and-drop ease:

 

Data has field for "Name" and "Suffix" (Jr., Sr., III, etc.). The salutation needs to read "Dear John Doe Jr.," or "Dear Steve Smith," so my thinking is that the JS would read something like "if (suffix) == "" then return "," else return " " + (suffix) + ","

 

(I know that is not actual javascript language, but I'm just trying to illustrate without actually looking up the proper syntax.)

 

What I can't figure out in the wizard is how to put the space before the "suffix" field in the else line.

You can't do any kind of string concatenation with the drag-and-drop Rule Wizard dialog. It's designed only for relatively simple rules which return a particular discrete bit of static text or a field value.

 

But you're really close on the JavaScript syntax. I think this is basically what you want:

var suffix = Field("suffix");
if (suffix == "") return ",";
//else
return " " + suffix + ",";

Link to comment
Share on other sites

Thanks, Dan. Like I said, I can cobble the JS together in a pinch, I was just hoping for an easier method like drag and drop using the Wizard. Since I can get it to add the comma after the suffix in the "else" line, it doesn't seem like it should be much of a stretch to be able to add the space before it using the same drag and drop methodology.

 

It seems to me that this is a relatively simple rule and I think users of FP would benefit greatly by improving the Rule Wizard so that things like this are easier. I would venture to guess that most users of FP are not coders or programmers, so anything that simplifies creation of good rules is great.

 

Will future updates/upgrades of FP address this? I hope so!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...