Nested if's


Is there a way to do nested ifs something like the below in a "if condition"
if ((x > 14) and (y>100))
    if (x > 20)
        return true;
        return false;
    return true;

I saw this:

but is there an easier way?
if(x > 14 and y > 100, if( x > 20, true, false), true)

if (x> 14 and x <= 20 and y > 100, false, true) ?

I would subscribe both Justin and "Statler". They are correct.

Basically, whenever x is between 14 and 20 (14 < x <= 20), being y greater than 100 (y > 100), it's always false.

Thank-you for your replies, but I was wondering if there was a better way to use if statements that was more readable and consistent with other programming languages.

For example, I decided to use the if statement to solve the large number of conditions to display a button, and this resulted:

If (GetProjectById.List.Current.Project.Stage <> Entities.ProjectStageRecords.Approved,

    If(GetProjectById.List.Current.Project.Stage = Entities.ProjectStageRecords.CCM,
        If(UserResponsiblities.List.Current.Responsiblities.isCCM, True, False),
     If(GetProjectById.List.Current.Project.Stage = Entities.ProjectStageRecords.PreCIO,

         If(UserResponsiblities.List.Current.Responsiblities.isPreCIO, True, False),

     If(GetProjectById.List.Current.Project.Stage = Entities.ProjectStageRecords.CIO,

        If(UserResponsiblities.List.Current.Responsiblities.isCIO ,True, False),

I pity the fool who might one day have to debug this code and then will have to go crying home to his mamma.
 - Quote from Mr T., A-Team
I'm guessing it's like this because it doesn't support parenthesis "{}" ?
if you have tons of if's most probably you better rethink the way you want to show a button

for example, call an action in the visible/enabled property with the needed values and return a boolean show/hide
then in the action you might want to use a switch-action.
or at least make use of thwe diamond-if's

Hi Michael,

As Statler wrote, a function (action with Function = Yes) could be used in the expression editor and would be more readable.

Another option would be using logical operators in your expression - see a simplified version below:

If(Stage = CCM and Responsiblities.isCCM,
 If(Stage = PreCIO and Responsiblities.isPreCIO,
  If(Stage = CIO and Responsiblities.isCIO, True, False)))

or you could replace the whole expression with just (again, a simplified version):

(Stage = CCM and Responsiblities.isCCM) or
(Stage = PreCIO and Responsiblities.isPreCIO) or
(Stage = CIO and Responsiblities.isCIO)

Thanks for your reply. Didn't realise I could create an action for this, the visual "if's" will look and work fine.