Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

The Nested if question

Featured Replies

Alright folks

 

I'm Confused on the nested If statement function while i understand that the if function is represented as If(Test on ; Result 1; Result 2) , I'm trying to wrap my mind around the nested function , heck i may be using the wrong function all together.

 

What I'm more so looking for is this

 

If(Test 1 ; Result 1(another If Statement with Result one) Result 2). I want to make multiple Items true prior to performing a calculation.

 

SO

 

If ( the Current year (on this layout) = Current year (On Different Table) and If( The Status of "Active" = Status (on Different Table) ; Sum (Field) ; if not then put 0) I have tried this statement and it doesn't work , If i remove the second IF statement then the first works with the result being the sum calculation. I'm thinking it is in my formatting of the calculation.

 

Here is what i am currently using

 

AddDollarFormat (If (Year=SLRP_PRJ_Projects||ID_Staff||::Year &  SLRP_PRJ_Projects||ID_Staff||::Status= "Active" ; Sum(SLRP_PRJ_Projects||ID_Staff||::contract override)))

 

Any Ideas?

I don't really understand what are you trying to accomplish. Nested Ifs are required* when multiple tests need to be performed in series, for example: If the year is current, then the result is x; if not, then check if the status is active: if yes, then the result is y, otherwise the result is z. I don't see this in your example that has only two possible results instead of three and the two tests need to be performed in conjunction.

 

The other thing that jumps out is that you are using the & text operator instead of the and logical operator.

 

 

---

(*) Actually, nested ifs are never "required" and it's much better to use the Case() function in these situations.

  • Author

Ok , Maybe if i descibe it like this

 

I have a field on each layout and table called year , this field gives me the year that an item was created based of the Date created so if it was created 03/01/2012 the year shows 2012

 

I have a field called Status on the layouts and Tables these have mutiple status choices i am only looking for the Status of active right now

 

So if the Recored was created in the year of 2012 and its status is Active the i want to add up all the contract amounts is what i am trying to do ,

 

 

I dont want it to calculate any thing other then if both statements are true.

 

As for a case

 

I thought a case was Case(Test one , Result one; Test two , Result two ; etc) How i write this in a case my first thoughts go to

 

Case(Year=SLRP_PRJ_Projects||ID_Staff||::Year ; ????? ; SLRP_PRJ_Projects||ID_Staff||::Status= "Active"; ????; Sum(SLRP_PRJ_Projects||ID_Staff||::contract override)

 

But what would i use as a result for each one? Obviously i want it two step through each test  and if each test pass's then and only then Perform the sum calculation .

So if the Recored was created in the year of 2012 and its status is Active the i want to add up all the contract amounts is what i am trying to do ,

 

That would come down to something like =

 

If ( Year = 2012 and Status = "Active" ; Sum ( Related::Value ) )

 

This will return the sum of related records when BOTH conditions evaluate as True; otherwise the result will be empty.

  • Author

awsome , thank you for helping to clear that up

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.