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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Comapring main report string with subreport string

Status
Not open for further replies.

vngpal

Programmer
Jan 14, 2004
35
0
0
US
Hello,
I am using CR8.5 with SQL Server database. I have a main report with subreport. In subreport I have one group and for each group there may be 1 or multiple detail lines. When inserting the subreport into the main report I am able to see one or multiple detail lines as per the group in subreport. Now I want to get the one or multiple detail lines as a string variable into the main report. I have created a formula Shared StringVar and placed in the subreport. This gives me one or multiple detail lines as per the group in the subreport. But in main report I have the same group and when I use the Shared StringVar formula I get only one line even if in the subreport there are multiple lines for that same group.
The reason why I need this is because I want to compare a string from the main report with the string in subreport. I do not know whether I can compare two strings one from main report and another from subreport.
For example if the subreport is grouped by state and state can have one or multiple cities. If the state has multiple cities, then I need all the cities in that state as a string var in the main report. But i get only one city name insted of multiple.

Can any one help me solve tis issue?

Thanks
 
Please show the formula you used to set up the variable in the subreport.

-LB
 
You can compare them, but you don't have a clear picture of what is happening.

If the formula is in the details, then the formula executes for every row in the details, and the value changes for each.

Instead of explaining data, show examples and then what you need.

-k
 
Below is the example
This formula is created in subreport.
//@City
Shared StringVar City := "";
City := {table.fieldname}

In the main report I have created a formula like this.
//@City
Shared StringVar City;

Let me know if you need any further info.

Thanks,
pal
 
Right, so you'll get one city per execution of the subreport.

I don't think you understand what variables are, or how they work,

You should supply examples of the data, and what you want to present, not specify architecture.

-k
 
Thanks for the feedback.
Here is the scnario.
I have a patient_table with patient number for each patient admitted. I also have logged_procedure table with patient number and procedure fields. In the logged_procedure table one patient can have one or multiple procedures. Similarly I have another table scheduled_procedure with patient number and procedure fields. Similarly in the scheduled_procedure table one patient can have one or multiple procedures. In the main report I can not link both the procedure tables with the patient_table. I can link either logged_procedure table or scheduled_procedure table with the patient_table.
If I link the patient_table with the logged_procedure table then I create a subreport and link scheduled_procedure table with patient_table. Now I want to compare the procedures (logged and scheduled) for each patient and see if there is any difference.

Hope this is clear now.

Thanks,
Pal
 
You could just say, no, I don't want to show example data and the expected output, let's just chat...

What does that city formula have to do with procedures then?

Oh well, I'll leave this thread to another...

-k
 
It is an example only. That is nothing to do with the scnario. Since that was not clear enough I have explained the scnario.

Thanks.
pal
 
You need to collect the city names within the subreport by using a formula in the detail section:

//{@City}:
whileprintingrecords;
Shared StringVar City;
City := City + {table.fieldname}+", ";

Then reference the variable in the main report and to compare one city in the main report you could use something like:

whileprintingrecords;
sahred stringvar City;
if {table.city} in City then 1 //flag

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top