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

Can you use Distinct Count without Grouping

Status
Not open for further replies.

omoralez

Programmer
May 1, 2006
23
0
0
US
I need to create Global numberVar's in a subreport of the total unique ReqID's to pass to a second subreport. I don't know how to do that using a group, but I also need the distinct count which occurs by using a group option. Can anyone tell me if there is a way to do this.

 
You don't need a group to use distinctcount. Create a formula:

whileprintingrecords;
shared numbervar uniqID := distinctcount({table.ReqID});

Place this in the subreport footer. Then in the second subreport, use a formula like this to reference the number:

whileprintingrecords;
shared numbervar uniqID;

You have to use shared, not global, variables if you want data to be shared between subreports or between main and subreport.

Where are your subreports located? If the subreports are placed in group sections and are linked to the main report on the group field, then the shared variable results will be per group (without changing the formula above).

Note that to pass successfully, the second subeport needs to be in a section below the one where the shared variable is created.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top