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

Using value from subreport in formula in main report

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I have a sub report which displays a value (distinct count of record). I want to be able to use this value in a formula in my container/main report. Is this possible ?
Cheers
 
Naith is right about the shared variable but it is a little more tricky than explained.

You declare the variable in the subreport

@initialize (suppressed in the subreport header)

Shared numberVar DistinctRecordCount := 0;

later in another formula you assign the proper value.

You create a formula in the main report to display the value

@display DistinctRecordCount

Shared numberVar DistinctRecordCount ;
DistinctRecordCount ;

Now the tricky part is that the subroutine must run before the shared value is past to the main report and to do this you place the subreport in a section immediately before you need the answer (creating a subsection if necessary) the subreport is suppressed and can be made as thin as possible if it is in a section by itself as you will never be able to totally suppress the section. Jim Broadbent
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top