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.

Nested Case calculations

Featured Replies

I need help with this calculation please. I need to designate which counselor the student has according to the students last name.

I have a calculation field that only looks at the left 2 letters of the last name. That is called "left last name".

Then I created a field and used this calculation... but it only is calculating the first part(grades 9-12) and not the second (grades 6-8)

 

Case(Grade Level="09"  or Grade Level="10"  or Grade Level="11" or Grade Level="12"  or Grade Level="9";

Case(
left last name>="A" and left last name<="E"; "Counselor 1";
left last name>="F" and left last name<="Le"; "Counselor 2";
left last name>="Li" and left last name<="Rh"; "Counselor 3";
left last name>="Ri" and left last name<="Z"; "Counselor 4";" "; 

Case(Grade Level="06"  or Grade Level="07"  or Grade Level="08" or Grade Level="6"  or Grade Level="7"  or Grade Level="8";

Case(left last name>="A" and left last name<"L"; "Counselor 5"; "Counselor 6"

))))

 

Any help would be appreciated.

A couple of potential issues I see is the use of "06" and "6".  Are these text fields?  A little nervous about have fields like that.  Also, you shouldn't have field names with spaces, for many reasons...

Try this in data viewer (can't test without a file), you'll have to change left last name to a full reference of YourTable::left last name.  Same for Grade Level.

Let([
   @name=left last name;
   @grade=Case(Grade Level="09"  
               or Grade Level="10"  
               or Grade Level="11"
               or Grade Level="12"  
               or Grade Level="9"; 
               1;2);//determine which group
   @Con1=Case(@name ≥ "A" and @name ≤ "E"; "Counselor1";
              @name ≥ "F" and @name ≤ "Le"; "Counselor2";
              @name ≥ "Li" and @name ≤ "Rh"; "Counselor3";
              "Counselor4");
   @Con2=Case(@name ≥ "A" and @name < "L"; "Counselor 5";"Counselor 6");
   @Con=Case(@grade=1;@Con1;@Con2)
    ];

@Con

)
  

 Edit:  Fixed typos.

Edited by Steve Martino

This way may be more accurate:

Let([
   @name=left last name;
   @grade=Case(Grade Level="09"  
               or Grade Level="10"  
               or Grade Level="11"
               or Grade Level="12"  
               or Grade Level="9"; 
               1;2);//determine which group
   @Con1=Case(@name ≥ "A" and @name ≤ "E"; "Counselor1";
              @name ≤ "Le"; "Counselor2";
              @name ≤ "Rh"; "Counselor3";
              "Counselor4");
   @Con2=Case(@name ≥ "A" and @name < "L"; "Counselor 5";"Counselor 6");
   @Con=Case(@grade=1;@Con1;@Con2)
    ];

@Con

)

  • Author

Thank you for your prompt reply.

The grade levels are stored as numbers. I removed the spaces from the field names. I tried your calculation and it worked!!! Thank you so much!!

5 minutes ago, TMC09 said:

...The grade levels are stored as numbers...

Then why do you have both 9 and 09?

If they are just numbers, then:

Let([
   @name=left last name;
   @grade=Grade Level;
   @Con1=Case(@name ≥ "A" and @name ≤ "E"; "Counselor1";
              @name ≤ "Le"; "Counselor2";
              @name ≤ "Rh"; "Counselor3";
              "Counselor4");
   @Con2=Case(@name ≥ "A" and @name < "L"; "Counselor 5";"Counselor 6");
   @Con=Case(@grade>8;@Con1;@Con2)
    ];

@Con

)

  • Author

That was an error on my part. I removed it since then.

Thank you!

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.