Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

multiple formulas formating?

Status
Not open for further replies.

lareya

Technical User
Jan 30, 2003
49
US
I have the following code that validates a users screen (surgery charting). How can I place these formulas so the info looks like this:

Please return to the Procedure\Staff\Room Button & go to the Procedure Screen Tab and check the Wound Class Field

Please return to the Procedure\Staff\Room Button & go to the Post Case Screen Tab and check the Pre Diagnosis field
etc.,

I am just trying to catch some critical missed fields. When they print the record it prints to the screen and these error messages in red will show them where they missed the fields to input data. All of these formulas work on their own. But when it is run as validation it obviously stops at the first error. How do I get it to continue to the end of the validation checks, and to place the appropriate error message up on the screen? I have a sneaky suspicion that I will have to break up this formula into individual formula's, but I don't want to do it that way if I can help it.

I have the validation formula running in the RH which is suppressed if it is empty. All the fields are either string fields or code fields which are number fields.


Code:
 @Validation
IF  {POST_PROCEDURE_DATA.WOUND_CLASSIFICATION} = ""  then
'Please return to the Procedure\Staff\Room Button & go to the Procedure Screen Tab and check the Wound Class Field '
else 
if {POST_CASE.PRE_DIAGNOSIS} = ""  then
'Please return to the Procedure\Staff\Room Button & go to the Post Case Screen Tab and check the Pre Diagnosis field '
else 
if {POST_CASE.DIAGNOSIS} = '' then
'Please return to the Procedure\Staff\Room Button & go to the Post Case Screen Tab and check the Post Diagnosis Field '
else 
if {Post_Case.TYPE_OF_CASE_CODE} = 0 then
'Please return to the Procedure\Staff\Room Button & go to the Procedure Screen Tab and check the Case Type Field '
else 
if {Post_Case.PATIENT_TYPE_CODE} =0 then
'Please return to the Procedure\Staff\Room Button & go to the Post Case Screen Tab and check the Patient Type Field '
else 
 if {Post_Case.Major_Minor_Code} = 0 then
'Please return to the Procedure\Staff\Room Button & go to the Procedure Screen Tab and check the Major/Minor Field '
else
if {POST_PROCEDURE.PROCEDURE_DESC} = "" then
' Please return to the Procedure\Staff\Room Button & go to the Procedure Screen Tab and check the Description Field '
else
if {POST_PROCEDURE.PROCEDURE_DESC} = "" then
' Please return to the Procedure\Staff\Room Button & go to the Procedure Screen Tab and check the Description Field '
else
IF {CODES_ANES_TYPE.ABBR} = "" THEN
' Please return to the Procedure\Staff\Room Button & go to the Post Case Tab and check the Anesthesia Type Field ' 
;

Thank you So much for your help! My info is in my sig file.

Lareya

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Crystal 8.5; ORSOS/One Call Hospital Scheduling System v9.3; SQL database; Huge Newbie to Crystal! Operating Room RN Analyst
 
Hi there,

I think you are going to have to split the formula's up into individual ones mainly because of how the formula is evaluating.

Have you tried splitting the RH into multiple sections, inserting 1 formula into each section and the suppressing if the field is null.

That way at least there will not be any spaces if say the first formula and the fourth formula are the only ones with values.

You can use variables too and assign each of the If-then-else formulas to a different variable, then assign all the variables to a display variable i.e display:= var1 + " " + var2 etc... or display:= var1 + chr(13) + var2 + chr(13) etc.. but personally i'd use the first method.

HTH



-Steve


"if at first you don't succeed, sky diving is not for you"!!! :eek:)
 
as long as your report only returns one record then try something like this

Code:
WhileReadingRecords;
Local StringVar strValidate;

(
If  {POST_PROCEDURE_DATA.WOUND_CLASSIFICATION} = ""  then
    strValidate := 'Please return to the Procedure\Staff\Room Button & go to the Procedure Screen Tab and check the Wound Class Field ';
 
if {POST_CASE.PRE_DIAGNOSIS} = ""  then
    if strValidate = "" Then
        strValidate := 'Please return to the Procedure\Staff\Room Button & go to the Post Case Screen Tab and check the Pre Diagnosis field '
    Else 
        strValidate := strValidate & chr(13)& chr(13)  & 'Please return to the Procedure\Staff\Room Button & go to the Post Case Screen Tab and check the Pre Diagnosis field ';

if {POST_CASE.DIAGNOSIS} = '' then
    if strValidate = "" Then
        strValidate := 'Please return to the Procedure\Staff\Room Button & go to the Post Case Screen Tab and check the Post Diagnosis Field '
    Else 
        strValidate := strValidate & chr(13)& chr(13)  & 'Please return to the Procedure\Staff\Room Button & go to the Post Case Screen Tab and check the Post Diagnosis Field ';

if {Post_Case.TYPE_OF_CASE_CODE} = 0 then
    if strValidate = "" Then
        strValidate := 'Please return to the Procedure\Staff\Room Button & go to the Procedure Screen Tab and check the Case Type Field '
    else 
        strValidate := strValidate & chr(13)& chr(13)  & 'Please return to the Procedure\Staff\Room Button & go to the Procedure Screen Tab and check the Case Type Field ';

if {Post_Case.PATIENT_TYPE_CODE} =0 then
    if strValidate = "" Then
        strValidate := 'Please return to the Procedure\Staff\Room Button & go to the Post Case Screen Tab and check the Patient Type Field '
    else 
        strValidate := strValidate & chr(13)& chr(13)  & 'Please return to the Procedure\Staff\Room Button & go to the Post Case Screen Tab and check the Patient Type Field ';

if {Post_Case.Major_Minor_Code} = 0 then
    if strValidate = "" Then
        strValidate := 'Please return to the Procedure\Staff\Room Button & go to the Procedure Screen Tab and check the Major/Minor Field '
    else
        strValidate := strValidate & chr(13)& chr(13)  & 'Please return to the Procedure\Staff\Room Button & go to the Procedure Screen Tab and check the Major/Minor Field ';

if {POST_PROCEDURE.PROCEDURE_DESC} = "" then
    if strValidate = "" Then
        strValidate := ' Please return to the Procedure\Staff\Room Button & go to the Procedure Screen Tab and check the Description Field '
    else
        strValidate := strValidate & chr(13)& chr(13)  & ' Please return to the Procedure\Staff\Room Button & go to the Procedure Screen Tab and check the Description Field ';

if {POST_PROCEDURE.PROCEDURE_DESC} = "" then
    if strValidate = "" Then
        strValidate := ' Please return to the Procedure\Staff\Room Button & go to the Procedure Screen Tab and check the Description Field '
    else
        strValidate := strValidate & chr(13)& chr(13)  & ' Please return to the Procedure\Staff\Room Button & go to the Procedure Screen Tab and check the Description Field ';

IF {CODES_ANES_TYPE.ABBR} = "" THEN
    if strValidate = "" Then
        strValidate := ' Please return to the Procedure\Staff\Room Button & go to the Post Case Tab and check the Anesthesia Type Field ' 
    else
        strValidate := strValidate & chr(13) & chr(13) & ' Please return to the Procedure\Staff\Room Button & go to the Post Case Tab and check the Anesthesia Type Field ' 
);

strvalidate

Gary Parker
MIS Data Analyst
Manchester, England
 
Thank you both for your suggestions. Okay, so I tried GJParker's suggestion, but I got the error of a limitation to 256 characters. So If I did a combo of the two suggestions by creating variables, of the longer formula (which is broken up), can I do something like this?

Have a formula that will give the first part of the error message:
varName1 := procedure\staff\Room ...Procedure
varName2 := procedure\staff\Room ...PostCase
for all the errors that belong to those different catagories

And then plug in the individual missing field within the message
'Please return to the Procedure\Staff\Room Button & go to the Procedure Screen Tab and check the VarMissingX Field

'Please return to the Procedure\Staff\Room Button & go to the Post Case Screen Tab and check the varMissingY Field

Does this make sense?

The reason I would like to make it formulas is that the above only covers two screens, and I have 18 more screens to validate. So I figure that there will be a lot of formulas to write to the RH, and I am not sure how to overcome the 256char limitation.

Thank you so much again!

Lareya





++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Crystal 8.5; SQL database; MS Windows 2K; ORSOS/One Call Hospital Scheduling System v9.3; Huge Newbie to Crystal! Operating Room RN Analyst
 
Being an ORSOS administrator (v8.5.5.2, gulp) I'm limited to having to use Crystal 7, I tried to emulate your problem and receive the same thing until I do as someone mentioned and create multiple formula fields and "suppress if zero" on them.

If you look at you're built in ORSOS error checking validation reports this is actually how they do it.
 
okay, I have gotten this far with my idea:
Code:
 WhileReadingRecords;
 Local StringVar strValidate2;
 StringVar  Error := 'Please return to the Time Out/Other Staff Button and check the '  ;

 (

if {WP_MISC.CHECK_17} = "" then
    if strValidate2 = "" Then
        strValidate2 := '   Pt ID x2 Field   '
    else
        strValidate2 := strValidate2 & chr(13)& chr(13)  & '   Pt ID x2 Field  ';


  IF {WP_MISC.MISC_03_TIME} = datetime(1800,01,01,00,00,00) THEN
    if strValidate2 = "" Then
        strValidate2 := 'Time Field' 
    else
        strValidate2 := strValidate2 & chr(13) & chr(13) & ' Time  ' ; 

        
if {WP_MISC.CHECK_18} = "" then
    if strValidate2 = "" Then
        strValidate2 := '   Procedure Field   '
    else
        strValidate2 := strValidate2 & chr(13)& chr(13)  & 'Procedure Field  ';

);

 Error  + strValidate2

The results I get with this is:
Please return to the Time Out/Other Staff Button and check the Time Field

So how do I make all these error msg show. do I do a counter? A loop? I am really stretching my brain for this. any help would be great. I really don't want to put individual fields in at a time. I will have way too many.

BTW, all these formulas work individually. I just need a way to cycle through them and show them on the report.

Also, I am not sure exactly what this part of the formula does:
strValidate2 := strValidate2 & chr(13)& chr(13) & 'Pt ID x2 Field ';

Thanks! - Lareya

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Crystal 8.5; SQL database; MS Windows 2K; ORSOS/One Call Hospital Scheduling System v9.3; Huge Newbie to Crystal! Operating Room RN Analyst
 
The error messages should al be there in teh string I think you need to format the field to 'Can Grow'

chr(13) inserts a carriage return

HTH



Gary Parker
MIS Data Analyst
Manchester, England
 
You are so right! I re-checked my formulas, and I had a little boo-boo (typo) in it. Thank you so much!

Lareya!

I will continue to re-use this convention, and place multiple sections in the header to supress, and I think my validation section will work quite will.

Thanks again!

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Crystal 8.5; SQL database; MS Windows 2K; ORSOS/One Call Hospital Scheduling System v9.3; Huge Newbie to Crystal! Operating Room RN Analyst
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top