Jump 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.

A more "elegant" CASE for multiple fields?

Featured Replies

Is there a more "elegant" method to test multiple fields with a CASE statement?

Example:

I have a layout with 51 fields whose value I have to check for "Pass" or "Fail"; ANY One or More "Fail" values out of the 51 is what I am "trapping". What I have done that works as intended is:

Case (

Field1 = 1 ; "Fail" ;

Field1 = 2 ; "Fail" ;

.

.

.

Field51 = 1 ; "Fail" ;

"Pass" )

Just wondering if thers is a "shortcut" to achieving the desired result :)

BTW, in "case" you are wondering what type of "test" in which just ONE "Fail" results in a "Fail", it is for a Line Check for 737 Captains! :)

Cheer!

Lyle

Hi Lyle, you will hate me for this but ... the best way to eliminate your problem is to have a related table instead of 51 'like' fields. Someone once told me that, if I did not have something positive to say not to say anything. However, I think that IS positive input because your life will be much easier. Seriously ...

Tell Steve hi! :wink3:

Agree with LaRetta, related records rather than fields would have been MUCH better.

Imagine, this: instead of pass or fail, the Score field in the Questions records contained 1 or 0. You could work out the person's Grade with just one calculation:

Grade = Sum( Questions::Score ) / Count( Questions::Score )

Although there is a simpler way, with 51 fields nothing is going to be simple. Even a repeating field with 51 repetitions would have been a better solution.

Once you have the scores in individual records of a related table, you can determine the Pass/Fail status simply by =

IsEmpty ( FilterValues ( "1¶2" ; List ( Scores::Values ) ) )

(this is assuming 1 and 2 are below the passing limit - your example is somewhat ambiguous in that respect)

All you need when 'Fail' is 1 and otherwise 0 is:

If [ Sum( YourTable::YourField]

as, if they are all 0 the result will be False, otherwise True.

  • Author

@ LaRetta - Steve says "howdy" :)

Yes, a related table is what I had expected, and what I had initially started to do. However, "they" told me, after I had started, that this particular Check is applicable to all crew on all aircraft types and will "rarely if ever change" (we've all heard THAT one before!). So I figured I would do it "quick & dirty" for now as they need this "yesterday". I will work this "mess" into the other area of the app for other checks where it will be done "properly" :)

@comment - the "Fail" score is 1 and 1 only. A score of 2 to 4 is a "Pass".

Thanks everyone for the advice and calcs! :)

@comment - the "Fail" score is 1 and 1 only. A score of 2 to 4 is a "Pass".

Well, then this one isn't right:

Case (

Field1 = 1 ; "Fail" ;

Field1 = 2 ; "Fail" ;

Anyway, the same method would still work =

IsEmpty ( FilterValues ( "1" ; List ( Scores::Values ) ) )

  • Author

oops! :) ... changed the wrong "1" to "2" after pasting a copy of the first one :idot:

Create an account or sign in to comment

Important Information

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

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.