Syntax Error If .. Then foirmula to assign value of a field based on the value of other field

The Scenario is as follows:

We have a Column List field Value_Type which can take one of the value from list randomly {“Value 1”, “Value 2”, …“Value 5”}

We need a field NoofOptions which will take the value based on Value_Type…

If Value_Type == 'Value 1" then “Single Option” else “Multiple” I am getting the following error when I try to preview

Syntax error in formula 'If Value_Type == ‘Value 1" then “Single Option” else “Multiple”’

Here is the correct syntax:

if field('Value_Type') == 'Value 1' then 'Single Option' else 'Multiple' end
1 Like

Thanks. That worked. Is there a link which provides documentation related to the Syntax, keywords etc. For e.g. in the above issue I had missed including “end” keyword at the end and missing single quotes in few areas

Formulas use Ruby syntax, so you can use something like: Ruby Syntax Reference For Beginners - RubyGuides