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

Select statements on shared data from a sub report

Status
Not open for further replies.

Deano1976

Technical User
Dec 16, 2004
41
GB
CR V8.5

I have passed through a value from a sub report to a main report and subsequently divided this value into a another value in my main report using a formula. I now want to do a select on the result of this formula, but Crystal is telling me the "formula cannot be used as it must be evaluated later".

So for example I have.

A field in my sub report called Weekly Sales Volume.
I have shared this field with my main report and also called it Weekly Sales Volume.
I have then created a formula called Remaining Stock, which divides a field in my main report called Closing Stock with the Weekly Sales Volume field.
I then want to be able to only select records where the result of this formula is less than a specified figure (1.5 for arguements sake).

Any ideas?
 
Subreports are run only after all of the data has been selected. That's how Crystal works, the framework you code within.

One possible answer is to reverse the relationship of the main report and subreport. Have your existing subreport become the main and call what is now 'main'.

Another is to select the data and use group suppression.

Things can also be done in SQL, if you have it. SQL in 8.5 is awkward to use.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
What do you mean by "Another is to select the data and use group suppression.
 
Another option, another possible answer

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
You will only be able to use section suppression. Go to the section expert->highlight the section you want suppressed and enter a formula into the formula area for suppress:

{@RemainingStock} > 1.5

You only be able to suppress those sections below the one in which the subreport is located.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top