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

Setting Record Selection Criteria on Sub Report. 1

Status
Not open for further replies.

debzz

Programmer
May 3, 2005
4
US
Hi Everyone,

I have a Crystal Report with a sub report. There is no field/fields that directly link my subreport to the main.
As the main report runs, I am building a coma delimited field of invoice numbers in a Shared Variable. When the report gets to the section I want my sub-report to print in,
this Shared Variable has a complete list off all the invoice numbers I'd like included in the sub report. I can pass this variable to the sub report, but cannot set my record selection formula to use this variable. Nor will it work with a formula field. (I've placed this data in a formula field as well, and tried it. It will not run this way.)

So basicaly I have a coma delimited list of invoice numbers, in a shared variable, that I want the sub report to use for record selection.

Example. Shared Variable="INVOICENBRS"
INVOICENBRS=123456,555555,222222,333333 etc...

Thanks!

D
 
Interesting how people prefer to describe how they intend to do something instead of stating their environment and requirements. Has it occurred to you that someone else might have a different way, and perhaps even a better way of accomplishing this?

Try posting technical information:

Crystal version
Database/connectivity used, and can you build database objects
Example data
Expected output

A shared variable can only be used whileprintingrecords, so another design makes sense.

-k



 
Select [Edit] on the menu and choose [Subreport Links]. That's how you pass data from the main report to the subreport. Shared variables are normally used for passing data back.

Note that when you make a link, it will automatically add this as a rule in the subreport record selection criteria. Check and adjust.

As for collective invoices, try something like this:
Code:
// Accumulate using a formula field (suppressed) in the detail line.  Allow for nulls and blanks.
whileprintingrecords;
if not isnull({Recc.Postcode}) and {Recc.Postcode} <> " "
then stringvar pst := pst + {Recc.Postcode} + ", "

Also consider if there is a better method that subreports. They are inefficient. And it helps to give your Crystal version.

[yinyang] Madawc Williams (East Anglia, UK) [yinyang]
 
Thank you Madawc. That did exactly what I wanted!!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top