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

Shared Variable in crystal report and filter data in subreport based on this value

Status
Not open for further replies.

DV1983

Programmer
Dec 24, 2014
1
AE
Hi All,
I am using crystal report 2008.
In the crystal report that I have designed, has a main report and a subreport.
A date value from main report has to be passed to the subreport and based on that date, the records should be filtered.
What I have done is created a shared variable for this date value in the main report,like below. The value is pulled to report and is showing the correct date value in main report.

WhilePrintingRecords;
shared datevar shdtvlu;
shdtvlu:={@dtvlu1};

Same has been created in subreport and is showing the date value, correctly,in the subreport.

shared datevar shdtvlu;
shdtvlu;

Now the result in the subreport ,should be filtered ,based on this value.
Records should be selected , which are less than this date value.

Can anyone please guide me on this regard?

Thanks to all the helping hands out there..
 
I believe you inserted the subreport in the main report already. Right click the subreport, select Edit Subreport; in the record selection formula editor(of the subreport) add the following.

[tt]{YourDateFieldinSubreport}<={?Pm-@DatesNeeded}[/tt]

Replace @DatesNeeded with the name of the formula in your subreport that contains the following code
[tt]shared datevar shdtvlu;
shdtvlu;[/tt]

Hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top