PDA

View Full Version : insert a sentence if value of iform field is x


n2_space
January 3rd, 2013, 12:24 PM
Hello all! I'm trying to update an existing template we have in our store that uses iforms and external data files. I want to create a rule to insert static text (just one sentence) at the end of a paragraph only if the value in the iform is a certain text. There are 12 different values in the value column of the iform that need to trigger this sentence to be inserted. We currently pull info from the external data files, but not sure how to create a rule to insert static text based on the drop down selection in the store corresponding to the value of the data in the iform.

Any thoughts? :confused:

Dan Korn
January 3rd, 2013, 12:49 PM
I would just create a Switch Wizard rule to map the field values to the static text. Or you could do it with a "switch" statement in JavaScript, something like this:
switch (Field("YourFieldName"))
{
case "value 1":
return "A sentence to add for Value 1";
case "value 2":
return "A different sentence for value 2";
// etc.
// etc.
case "value 12":
return "A sentence for value 12";
default:
return "";
}

n2_space
January 4th, 2013, 07:12 AM
I would just create a Switch Wizard rule to map the field values to the static text. Or you could do it with a "switch" statement in JavaScript, something like this:
switch (Field("YourFieldName"))
{
case "value 1":
return "A sentence to add for Value 1";
case "value 2":
return "A different sentence for value 2";
// etc.
// etc.
case "value 12":
return "A sentence for value 12";
default:
return "";
}
thanks! used thw switch rule and got it all working, hurray! :)