How to tell if a patient has had any orders placed on the current case

One very simple way to find out if any orders were placed may be to check the value of the VIST SEGMENT field C1424 - LAST ORD NO,   If this field is valued and greater then 0, then the patient has had an order placed at some time.  There are a couple of problems with this approach:

bulletIf you use multiple visit processing you have to check each visit segment under the current case
bulletSometimes it may be difficult to get the proper VISIT SEGMENT data fields into the AUDA.

Another, rather simple approach would be to use the Print/Display orders program CHPPO477 and the %-Fields %ORDSIND and %%ORPOQAL.   %ORPOQAL 

bullet%ORPOQAL tells CHPPO477 that if %ORSIND is valued, to exit the program as soon as a qualifying order is found.
bullet%ORDSIND tells CHPPO477 that you want to unload data in the the AUDA, that you do not want to print or display the data.

IF CHPPO477 is run and an order is found that qualifies then the program will exit with %ORPOTOT=1 (indicating that 1 order was found).  If CHPPO477 exits and %ORPOTOT is unvalued or is valued to 0 then no orders were found

To make this work properly (to check for any possible orders):

bulletRemove any and all date parameters:
bulletDisable security checking:
bulletValue %ORSIND=1
bulletValue %ORPOQAL=1
bulletStack $P=CHPPO477

If the patient has ever had an order entered on this case then after CHPPO477 runs, %ORPOTOT should be valued to '1'.

If the patient has not had an order enter on this case, then %ORPOTOT will be unvalued, or will have a value of 0.

NOTE: This same concept may be used much more broadly and specifically to see if the patient has any orders for particular departments or if they have any orders of a particular status.