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!

Shared variable in subreport does not group on server

Status
Not open for further replies.

RustyAfro

Programmer
Jan 12, 2005
332
US
Hello,

If I sum a database value in a subreport in a group, the SQL performs the group by on the server. But if I declare a shared variable to do the exact same thing it does not.

Is there a way to get crystal to perform grouping on server with a shared variable in a sub report so I can pass it to the main?

Thanks,

Joel
 
One doesn't really have to do with the other. What is your goal here? Why are you relating grouping on the server within the sub to whether or not a shared variable can be passed? Not following.

-LB
 
Sorry, let me try to explain.

I am having no issues with passing the variable back to the main, that works fine. It's how the SQL is being passed to the server that I have a problem with.

If the sub report does NOT perform grouping on server, then roughly 4,000 rows come back into the sub, are aggregated, an displayed properly in the main along with the two shared variables passing in properly.

If grouping on server is performed, then only about 10 rows come back and it runs about 5 times faster with the same result in the main.

I can get the sub report to group on server. But as soon as I put a shared variable that sums a database number in the only Group, the report does not group on server anymore. If I remove it, grouping on server occurs again.

Here is the formula:
Code:
Shared Numbervar MbrsCurrent:=SUM({UWVW_PHID_PROD_MBRS.ELG_CN},{UWVW_PHID_PROD_MBRS.PH_CAT_MED_TYP_CD})

I've experimented a bit and found that any "SUM" formula in the report kills the grouping on server. It may just be how crystal works (but it's definitely a bad feature since the sums in a formula happen on Pass 2 anyways so the SQL shouldn't be affected!)
 
I don't think the issue is the shared variable. I just tested this in a regular report, and I could create a shared variable without losing the group by on the server--as long as I suppressed the detail section. So, did you suppress the detail section within the sub?

-LB
 
Yes, detail section is suppressed. That's really strange that it works for you.

Does your shared variable sum a measure in your group?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top