Skip to Content
0

Can return a string not the column?

Jan 03 at 08:45 PM

43

avatar image
Former Member

HI I have a logic to implement as follows.

We have some patients who were given a screen test by their main Doctor, within a time frame.

To determine the score ( it is not kept electronically), we look at another Medical dept. here, and if the patient had a visit in that second dept. we are accepting this as the Positive score.

So I have a sub report that takes the patient number and checks the billing table for the time frame and a date of service in that second dept. and then I put the patient number in the sub report. So back to the main report I have the patient number. What I would like is it should display 'POS' or 'NEG' if there was a match in the sub report.

I tried to record select in the main on this but it wont locate the sub report col. in use.

I am not sure how to do this in the sub report. Or do i need a command in the sub report?

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

4 Answers

Best Answer
Dell Stinnett-Christy Jan 09 at 05:18 PM
0
I tried to record select in the main on this but it wont locate the sub report col. in use.

You cannot access subreport data in the Select Expert in the main report in order to filter your main report. If you need to do that, I would recommend reversing them so that what is now your subreport is the main report and vice versa. You could then pass the value from the main report into the subreport as a link.

If you just want to pass the information out of the existing subreport to your existing main report, you'll have to use a global variable that is initialized in the main report, set in the subreport, and then viewed in the main report. You'll want to initialize it to a blank for each patient in the main report so that you can't potentially get the previous patient's value from the sub.

-Dell

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Jan 03 at 09:51 PM
0

This is very good but the thing is I don't have the score. I have the fact that the patient visited the second dept.

Based on this event, we are taking it as a pos score. So if I have a match instead of returning the patient_number if it can say 'POS' or if no patient_number, meaning the patient did not visit the second dept. we take as a neg score. this is the best we can do because they are not entering the scores to where I can make use of them.

Share
10 |10000 characters needed characters left characters exceeded
Brian Dong Jan 03 at 09:10 PM
0

Hi Paul,

In the subreport, you can have a formula with a Global variable that can pass the number back to the main report.

In the main report, create a formula using the Global variable and something like:

WhilePrintingRecords; 
Global NumberVar score; 

if score > 0 Then 
     "POS" 
Else "NEG"; 

score will need to be the variable in the subreport.

The subreport must be in a section above this formula in the main report. Crystal evaluates left to right, top down. So it has to run the subreport and populate the variable before it can pass the variable back to the main report.

Good luck,

Brian

Share
10 |10000 characters needed characters left characters exceeded
Brian Dong Jan 04 at 12:39 AM
0

Hi Paul,

If you group your main report on patient_number and drop your subreport in the Group Header or Footer and link it on patient_number. In your subreport do a count of the patient_number and send it to the global variable. When you initialize the global variable in the subreport, set it to 0 otherwise you may be passing a NULL which will cause problems if there are no matches.

Now you have a number to pass back to the main report.

Brian

Share
10 |10000 characters needed characters left characters exceeded