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!

Using subreport distinct count value in formula of main report ?

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
0
0
Hi,
Im trying to create a formula. I want this formula to take a distinct count from my main report (support calls assigned to a person) and a distinct count from a sub report (support calls closed by a person) and use these two formulas to find a percentage of calls assigned which were then closed.
The problem Im having is getting access to the distinct count value, from the subreport, in my main report.

Using crystal 8.5
 
You need to create a formula with a shared variable that stores the value in the subreport, and then another formula in the main report that uses the shared variable. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Pass the value of the subreport's count to a shared variable. Then call the shared variable in the main report.

Naith
 
ok so I create a formula in my subreport saying something like:

shared calls_assigned as number
calls_assigned = DistinctCount ({INCIDENT.INCIDENT_REF})
formula = calls_assigned

then in my main report I create a formula saying:

Dim result As Number
Shared calls_assigned as number
result = (100 / calls_assigned)
result = result * DistinctCount ({INCIDENT.INCIDENT_REF}, {ASSYST_USR.ASSYST_USR_N})
formula = result

I get a 'division by zero' error. So I guess the fact that Im declaring the calls_assigned variable again sets it to 0. But if I dont declare it again I get 'expected date,number....' just after the 100 /

Please help :)


Cheers
 
I envisage something like this for you:

**Subreport**
shared numbervar counter2 := distinctcount({field})

Assuming you've already assigned a similar instruction to another variable called counter1 in the main report:

**Mainreport**
whileprintingrecords;
numbervar counter1;
shared numbervar counter2;

counter2 % counter1;


Naith
 
Thanks a lot Naith !
I just realised I had put all my formula on my report but had obe suppressed. Unsuppressed it and we got data in the other formula !!

Also swapped, so I declared shared variable in main report and global in subreport. Then displayed the % result in the subreport.

All working fine.

Thanks again.
Russ

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top