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

Compare a field from main report against a field from a subreport on CRYSTAL REPORT

Status
Not open for further replies.

Ajmal N

Technical User
Jun 16, 2021
7
GB
I was wondering if there is a way for comparing a field from the main report against the a field from a subreport.
My main report is pointing to the current month data and the same report is pointing to the previous month data in the sub report.

I need to do something like:
IF SubReportStatus(previous month) = '1-30 days' AND MainReportStatus(Current month) = '31-60 days' THEN "Worse" ELSE IF
IF SubReportStatus(previous month) = '61-90 days' AND MainReportStatus(Current month) = '91+ days' THEN "Worse"

etc etc.

It would be really helpful and really appreciated to know if there's a way this can be done.

Many Thanks
 
You can return info from the subreport to the main report via a shared variable.
Or you can pass information from the main report into the subreport using a subreport link.


view, export, burst, email, and schedule Crystal Reports.
 
Hi Ido,

How would I go on about doing that?
I have tried a few ways, but what sort of shared variable and what would the steps be.
I want to be able to achieve the below and the outcome comes on the current month (main report):
IF SubReportStatus(previous month) = '1-30 days' AND MainReportStatus(Current month) = '31-60 days' THEN "Worse" ELSE IF
IF SubReportStatus(previous month) = '61-90 days' AND MainReportStatus(Current month) = '91+ days' THEN "Worse"

 
1) Declare a shared variable in the subreport and assign it a value

2) in the main report, somewhere after the placement of the subreport, compare the shared variable to the main report value


Macola Software Veteran and SAP Business One Consultant on Training Wheels

Check out our Macola tools:

 
Hi Dgillz,

The field's I am trying to compare are text fields.
Can you please provide an example as to how I can declare this please?
I tried a few different ways but non worked.

Thanks
 
In the subreport:

Shared Stringvar MyVar:={MySubreportField}

In the main report:

If Shared Stringvar MyVar<>{MyMainReportField} then.....

Macola Software Veteran and SAP Business One Consultant on Training Wheels

Check out our Macola tools:

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top