How to Use a Simple If Statement in a Parameter Field
The following piece of Ruby code will let you add an if statement into your parameter fields. This will allow you to have different values/data passed either farther along the workflow, or directly into fields on a form (or wherever you are passing data to).
Here is the basic structure of the if statement:
Conditional Statement ? True : False
An example where 'if question' is a radio button choice with Yes and No as the options.
<%=@values['if question'] == "Yes" ? "You Said Yes": "You Said No" %>
If the answer is Yes, you get the text "You Said Yes" if No you get the text "You Said No".
It is also possible to use the longer format:
if conditional statment
true
else
false
end
This is the same example in long format:
<%= if @values['if question'] == "Yes"
"You Said Yes"
else
"You Said No"
end %>
Updated almost 2 years ago