Thanks for any help in advance. Seems like something that should be easy, however I’m not finding any solution while searching.
I have an input that return’s a person’s birthdate formatted as YYYY in an input field called ‘Input Pension BY’. In another input field I want to capture a number (age) based on the BY.
As a more experienced Excel user I would have a nested if/then statement, something like: IF(BY<=1964,56,IF(BY=1965,56.2,IF(BY=1966,56.4,IF(BY=1967,56.6,IF(BY>=1968,57,0)))))
I used my local AI for help and said I couldn’t use an input field but to use a text field. Here’s the JSON code my AI gave me to paste into the text field:
IF (Input Pensions BY <= 1964) THEN {
MRA = 64;
} ELSE IF (Input Pensions BY == 1965) THEN {
MRA = 56.2;
} ELSE IF (Input Pensions BY == 1966) THEN {
MRA = 56.4;
} ELSE IF (Input Pensions BY == 1967) THEN {
MRA = 56.6;
} ELSE IF (Input Pensions BY == 1968) THEN {
MRA = 56.8;
} ELSE IF (Input Pensions BY == 1969) THEN {
MRA = 56.1;
} ELSE IF (Input Pensions BY >= 1970) THEN {
MRA = 57;
}
I changed the plain text of Input Pensions BY into dynamic data as Input Pensions BY’s value, but when I preview it just shows the code as text and not calculating anything.
A way to perform nested if / else checks is to do:
Input Pensions BY ≤ 1964:formatted as text → then you can further perform calculations / operations for yes & for no values. Each value that you generate can be further nested and so on. Downside of that is that it only returns a text at the end. But you can format this back as a number again if you need the 64 / 56.2 etc. values as float
I’d advise that you do that within a hidden input / text element in the Frontend as when performed in workflows and used as returnvalue, sometimes it will not further go into nested conditions or the Workflow cannot use the returned text properly as value to process data so best to transform the input into a usable value on the Client and then use these inputs for further processing.