Reid Posted September 16, 2010 Posted September 16, 2010 What is wrong with this function? It is telling me that an operator is expected at the last semi colon and beyond. Like it doesn't like the last part. If ( Appointment Type = "C" ; If ( Total TIme > 1 ;"O" ) ; Appointment Type ) ; Appointment Type
LaRetta Posted September 16, 2010 Posted September 16, 2010 (edited) You are missing the end bracket but tell us what you want in human words. Even if we solve your calculation, it wouldn't be very efficient. UPDATE: For instance, it sounds like you want this: If there is a number in total time and the Type is "C", enter a "O" otherwise leave it as it stands still with the Appointment Type. Is that what you want? Hi Daniele! :smile2: Edited September 16, 2010 by Guest
Raybaudi Posted September 16, 2010 Posted September 16, 2010 Do you meant to say : what is right ? I think that it's better if you say us your question ( your calculation ) in plain english.
David Jondreau Posted September 16, 2010 Posted September 16, 2010 (edited) What is wrong with this function? It is telling me that an operator is expected at the last semi colon and beyond. Like it doesn't like the last part. If ( Appointment Type = "C" ; If ( Total TIme > 1 ;"O" ) ; Appointment Type ) ; Appointment Type Semi colons delimit function parameters. Parens enclose function parameters. You have a function, If(), and all the parameters (test; result; default result) need to be within parens. In short, move your last parens to the very end. If you moved your last parens to the very end, you'd be enclosing your function, but you'd have 4 parameters which is too many for If(). Delete the last "; Appointment Type". Edited September 16, 2010 by Guest
Reid Posted September 17, 2010 Author Posted September 17, 2010 You are missing the end bracket but tell us what you want in human words. Even if we solve your calculation, it wouldn't be very efficient. If I add the end parenthesis it says I do not have an equal number of parenthesis. Here is what I want, If the appointment type is "C" I want it to be changed to an "O" if the total time is more than 1 hour.
Reid Posted September 17, 2010 Author Posted September 17, 2010 If you moved your last parens to the very end, you'd be enclosing your function, but you'd have 4 parameters which is too many for If(). Delete the last "; Appointment Type". If I delete the last ; Appointment Type then it would be an incomplete function. I'm trying to create a nested if function. So: If (test1=1 ; if ( test2=2 ; result1b ; result2b) ; result 1b
comment Posted September 17, 2010 Posted September 17, 2010 (edited) I'm trying to create a nested if function. Why not use the Case() function instead? --- BTW, two nested If() functions would look loke this: [color:blue]If ( test1 ; result1 ; [color:red]If ( test2 ; result2 ; defaultResult ) [color:blue]) Edited September 17, 2010 by Guest
Lee Smith Posted September 17, 2010 Posted September 17, 2010 I would use a Case Statement Not sure if the results are what you are looking for, but this calculation Case ( Appointment Type = "C" and Total Time > 1; 0 ; Appointment Type) Produces a 0 if both conditions are met, and sets it to the Appointment Type if not. Lee
Reid Posted September 17, 2010 Author Posted September 17, 2010 I would use a Case Statement Not sure if the results are what you are looking for, but this calculation Case ( Appointment Type = "C" and Total Time > 1; 0 ; Appointment Type) Produces a 0 if both conditions are met, and sets it to the Appointment Type if not. Lee This works great! One last thing that I just noticed. I need appointment type to be either C OR S. I tried this but it doesn't seem to work. Case ( Appointment Type = "C" or "S" and Total TIme > 1 ;"O" ; Appointment Type )
Lee Smith Posted September 17, 2010 Posted September 17, 2010 (edited) How about: Case ( Appointment Type = "C" and Total Time > 1; 0; Appointment Type = "S" and Total Time > 1 ; 0 ; Appointment Type) Lee Edited September 17, 2010 by Guest removed the second calc, did hold up
comment Posted September 17, 2010 Posted September 17, 2010 How about: Case ( ( Appointment Type = "C" or Appointment Type = "S" ) and Total TIme > 1 ; "O" ; Appointment Type )
Reid Posted September 17, 2010 Author Posted September 17, 2010 How about: Case ( ( Appointment Type = "C" or Appointment Type = "S" ) and Total TIme > 1 ; "O" ; Appointment Type ) Thanks Comment! Works great!
Recommended Posts
This topic is 5179 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 accountSign in
Already have an account? Sign in here.
Sign In Now