Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

This topic is 5712 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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?

Posted

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 ?

Posted (edited)

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

This topic is 5712 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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