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.

Case does not seem to work within a Let fcn

Featured Replies

Hello Mavens,

What is wrong with this function:

Let([

 Case ( 

     PatternCount ( "I" ; rx_med_SIG ) ; x = 1; 

     PatternCount ( "II" ; rx_med_SIG ) ; x = 2; 

     PatternCount ( "III" ; rx_med_SIG ) ; x = 3; 

     x = "" );

 Case ( 

     PatternCount ( "QD" ; rx_med_SIG ) ; y = 1; 

     PatternCount ( "QHS" ; rx_med_SIG ) ; y = 1; 

     PatternCount ( "BID" ; rx_med_SIG ) ; y = 2; 

     PatternCount ( "TID" ; rx_med_SIG ) ; y = 3; 

     PatternCount ( "QID" ; rx_med_SIG ) ; y = 4; 

     y = "" )

 ];



x * y

)

FM complains at the first "(" after the first "Case" that it needs a "number, text constnat, field name or "(" is expected here".

The Case statement seem perfectly well formed, in fact if I copy it into another field and remove the "x=" characters, it works as expected.

I think the Let fcn is well formed as well because if I replace the Case statements with simple x=1 and y=2 statements, FM stops complaining.

What gives?

Hi

that calculation has many errors.

Can you give me some examples of what the field rx_med_SIG may contain ?

For example: do you really want that if that field contains "QD", the result must be 0 ?

You must specify a variable within the Let(), such as:

Let([

x =

Case (

PatternCount ( "I" ; rx_med_SIG ) ; 1;

PatternCount ( "II" ; rx_med_SIG ) ; 2;

PatternCount ( "III" ; rx_med_SIG ) ; 3

);

y =

Case (

PatternCount ( "QD" ; rx_med_SIG ) or PatternCount ( "QHS" ; rx_med_SIG ) ; 1;

PatternCount ( "BID" ; rx_med_SIG ) ; 2;

PatternCount ( "TID" ; rx_med_SIG ) ;3;

PatternCount ( "QID" ; rx_med_SIG ) ; 4

)

];

x * y

)

Calculation manually corrected and untested.

UPDATED: Corrected calculation (removed bracket and extra semi-colons

Edited by Guest

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.