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.

Using the MAX function within a CASE statement

Featured Replies

This has just gotta be a no-brainer, but maybe that's my problem smirk.gif.

Anyway, I'm trying to get the maximum grade for each enrolled student and from there I have a calculation which will return the graduation year.

My uncooperative calculation is:

Case

(Max (grade) = "4", graduationYear4thGrade,

(Max (grade) = "5", graduationYear5thGrade,

(Max (grade) = "6", graduationYear6thGrade,

(Max (grade) = "7", graduationYear7thGrade,

(Max (grade) = "8", graduationYear8thGrade,

(Max (grade) = "9", graduationYear9thGrade,

(Max (grade) = "10", graduationYear10thGrade,

(Max (grade) = "11", graduationYear11thGrade,

graduationYear12thGrade))))))))

But I keep getting an error message -- "There are too many separators in this function." The 'function' selected is "5", which looks to me to be identical to "4", but apparently isn't.

Can anyone tell me what I'm doing wrong?

Abbe

H Abbe,

I'm on my way out the door for a bit, but you could Try putting the =4, etc inside the (grade) i.e. (grade=4) etc.

Let me know if it is still broken

Lee

Why do you use " " for numbers ? I noticed sometimes the error message doesn't go to the first error when there are more than one.

  • Author

Darn program is fussy about that too!! Tried it and FileMaker won't let me put the operator inside the () as in (max (grade = "4")...

Abbe

  • Author

I get exactly the same error message without the ""...

Abbe

Try it this way:

Case(

Max (grade) = 4, "graduationYear4thGrade",

Max (grade) = 5, "graduationYear5thGrade",

Max (grade) = 6, "graduationYear6thGrade",

Max (grade) = 7, "graduationYear7thGrade",

Max (grade) = 8, "graduationYear8thGrade",

Max (grade) = 9, "graduationYear9thGrade",

Max (grade) = 10,"graduationYear10thGrade",

Max (grade) = 11,"graduationYear11thGrade",

"graduationYear12thGrade")

A case statement does not require a ( and ) for each condition.

  • Author

Sistrother...

Thanks for the suggestions, but won't FileMaker take the phrases inside the "" as literals? They're not; they're other calculated fields.

Abbe

Hi Abbe

I'm back and I see you got a lot of help while I was gone. You are correct, you do not need the "" if they are fields.

Lee

  • Author

NOW I see what you're trying to show me!

I put the extra ( and ) for the MAX function, not the CASE. But either way, I was wrong.

You fixed it!! Thanks.

Abbe

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.