Jump to content

insert a sentence if value of iform field is “x”


n2_space

Recommended Posts

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:

Link to comment
Share on other sites

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 "";
}

Link to comment
Share on other sites

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! :)

Edited by n2_space
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...