Asu Posted June 2, 2009 Posted June 2, 2009 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?
Raybaudi Posted June 2, 2009 Posted June 2, 2009 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 ?
LaRetta Posted June 2, 2009 Posted June 2, 2009 (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 June 2, 2009 by Guest
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now