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!

Evaluate shared variables for every record..... 1

Status
Not open for further replies.

robmason10

Technical User
Apr 9, 2002
68
GB
I now have a report that contains 3 subreports in DetailsA - these subreports have all their sections individually supressed but pass a variable to the main report which uses a formulae (shown below) to display the required field in DetailsB - DetailsA is set to 'Underlay following sections' so that the subreports are effectively hidden and only the shared variable details are shown.

This all works fine when I am using the report for a single record selection but when I want multiple records the variables shows previous evaluations due to much of the data being NULL

i.e.

Record 1 123 345 567
Record 2 abc cde efg
Record 3 abc cde F12

when I know cols 1 and 2 for record 3 are blank in the data - basically the Shared variable is not re-evaluating if the data is null - doe stht make sense?

Shared Variable creation in subreport:
//@CostToDate
//Stores the Cost to date of the
//{tblAccountLedger.monAccountLine} field
//in a currency variable called 'CostToDate'

WhilePrintingRecords;
Shared currencyVar CostToDate := Sum ({tblAccountLedger.monAccountLine})

Retreival of shared variable in Main report:
//@CostToDate
//Returns the value that was stored
//in the shared currency variable called
//CostToDate in the subreport

WhilePrintingRecords;
Shared CurrencyVar CostToDate;
CostToDate

make any sense to anyone?
 
In the subreport create a formula:

Shared currencyVar CostToDate := 0

and place in the header.





Reebo
Scotland (Sunny with a Smile)
 
Prior to executing the subreport, reset the variable in the main report as in:

WhilePrintingRecords;
Shared currencyVar CostToDate := 0

-k
 
How would you reset the variable in the main report when the sub report is in the detail?

Would you have to insert a second detail section with the formula in, or is there a better way?

Reebo
Scotland (Sunny with a Smile)
 
Yes, Reebo, you would have to place the reset in an exclusive detail section if you wanted to reset it in the main report, as you can't reliably reset it in details a or b, unless you introduce a details c.

Resetting in the subreport header is probably the best option. Looks like you're on a roll today...

Naith
 
WayHey......Compliments from Naith.....That's it, I'm going to quit while I'm ahead.

See ya tomorrow, when normal services of dodgy advice will be resumed.

Reebo
Scotland (Sunny with a Smile)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top