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

Shared Variable different in Subreport

Status
Not open for further replies.

bojimuncher

IS-IT--Management
Jul 10, 2009
21
CA
Heya all,

I have made a subreport with the formula...

whileprintingrecords;
shared numbervar contractitemprice:= {ICPRICP.UNITPRICE}-({ICPRICP.UNITPRICE}*({@Contract Price Level})/100)

it gives me the results im looking for in the subreport, but then when I try and pass the data on to the main report with my formula...

shared numbervar contractitemprice

it is giving me a different result.

The variable is in the report after the subreport and I'm thinking the result that it is getting is not taking the subreports selection criteria into account, I can post more info if needed, but im hoping/thinking this is just a simple mistake I'm making since I haven't used it in a while. Any ideas?

Thanks.
 
The main report formula must be in a different section BELOW the subreport. This is because the main report formula is evaluated before any subreport in the same section.

hth,
- Ido

view, email, export, burst, distribute, and schedule Crystal Reports.
 
I spoke too soon.. I put the subreport in Details A and the formula with the shared variable in Details B and it works as long as there is there is new data in the subreport to passover, but if there isnt anything new, it carries over the total from the previous row until there is new data.
Is there somewhere I could equal my shared variable to 0 so if it doesn't find any new data it just brings the 0 over instead?

Thanks again,
 
Add a detail_c section and insert a reset formula there:

whileprintingrecords;
shared numbervar contractitemprice := 0;

You can suppress this section.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top