Expand my Community achievements bar.

SOLVED

If Statement Multiple Conditions

Avatar

Level 2

Using LiveCycle, FormCalc or JavaScript.

I am trying to create an if statement with multiple conditions.

a Sum field calculates a series of numeric input fields. I want the result in the Sum field to determine the expression in a final field. 

If the Sum is <30MM then "50000" also if the Sum is >30MM but <60MM then "125000" also if the Sum is >60MM but <100MM then "250000" also if the Sum is >100MM but <300MM then "375000" also if the Sum is >300MM then "500000"

I have only been able to figure out a single if then for the first condition but not able to include the whole set of conditions and the multiple results.

Help would be much Appreciated!


Thank you in advance.

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

Send your form to LiveCycle8@gmail.com and I will ahve a look and see what is wrong.

Paul

View solution in original post

5 Replies

Avatar

Former Community Member

I woudl use a Javascript

switch staement.

switch (expression)

{

     case label1:

          statement1;

          statement2;

          break;

     case label2:

          statement1;

          statement2;

          break;

}

You can cover as many cases as you want. If you do a web serach for Javascript Switch statement there are numerous examples out there that you can follow.

Paul

Avatar

Level 2

Tried a few variations of this and still seem not

to be able to find a solution to this issue. I'm surprised my google searches are bringing up better examples because there seems to be an example of everything else.

Any more detailed advive?

Avatar

Correct answer by
Former Community Member

Send your form to LiveCycle8@gmail.com and I will ahve a look and see what is wrong.

Paul

Avatar

Level 2

Paul, Thanks so much! Perfect!!

Avatar

Level 1

It helps everyone else when correct answers are also posted...

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----