
Comparing Data in Subreports
Variable scope (Local, Global and Shared) turned up in CR7, and you actually need Shared variables to exchange data between a main report and a subreport.
It might be simplier to create a Paramater in your subreport and then link the field in the main report to that parameter.
> I want to know how I can create a formula to compare fields between the sub report and main report.
> In other words, there is a field in the sub report called INSTOCK, and I have another field in the main report called
> REQUIRED.
In Crystal 8 you can use the new function to define Global vars. These are known in both the main report and the subreport. The syntax could be something like this:
Formula in SubReport:
Global NumberVar InStock;
InStock := {Article.InStock};
Formula in MainReport:
Global NumberVar InStock;
Local NumberVar OrderQuantity:
OrderQuantity := InStock - {Order.ArticlesRequired};
For older versions you could create almost something like this using the functions in UFLSTORE.ZIP. This file can be downloaded from the Crystal Support website.
Gert
p.s. newsgroup messages are preferred to be in ASCII.