Jump to content

Using "if" and "else" statements in a script


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

Recommended Posts

I am trying to allow an office staff to enter codes throughout the day, and run a script at the end of the day that prints out letters to be sent. For example, in the field "code" the number "1" would print out a letter confirming an appointment date and time for a patient. The number "2" might print a letter to a patient that missed an appointment. The script I wrote is as follows.

find all

enter find mode

insert text (specify "code" field)>0

Perform find

loop

if "code = "1""

go to layout "confirm appointment"

Print (no dialogue)

Else

if "code = "2""

go to layout "missed appointment"

Print (no dialogue)

Go to record Next

end loop

end if

end if

The end result is not what I want? I expected to get letters to patients with new appointment, and different letters to different patients who missed appointment. I am getting multiple copies of the same letter to the same patient as if my loop or my "if" statement is not working. Any advice would be appreciated.

Link to comment
Share on other sites

Your If's are inside the loop and the End If's are outside the loop. You need to have your end loop after the last End If.

For the sake of efficiency, why not do a find for code = 1 and print all those letters at once. Then, do a find code=2 and print all those letters. Then you don't need any If's or loops.

Link to comment
Share on other sites

This topic is 7317 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
 Share

×
×
  • Create New...

Important Information

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