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!

Reseting Shared Variables

Status
Not open for further replies.

swhiteside

Technical User
Sep 8, 2014
4
US
I have a report that has several sub-reports and shared numbervars. I am trying to reset the variable to zero so I can run a range of reports. The report works when you run one at a time, but not when you run it for a range of jobs.

On the main report I have 3 formulas all located in GF1a:
WhilePrintingRecords;
if shared numbervar H = 0 then 0 else {@Cost_1_Gross_Profit}/ shared numbervar H;

WhilePrintingRecords;
if shared numbervar H = 0 then 0 else {@Estimate_Gross_Profit}/ shared numbervar H;

WhilePrintingRecords;
if Shared numbervar H = 0 then 0 else (Shared numbervar G;) / shared numbervar H;

In the sub-reports I have the following formulas in the RFb:
whilePrintingRecords;
shared numbervar H:= sum ({JC_TRANSACTION_HISTORY.Total_Hours}); ""

WhilePrintingrecords;
Shared numberVar z := {@GM Based on Labor}

WhilePrintingRecords;
shared numbervar G:={@GROSS MARGIN}

I have tried the following formula in the GF1b for all shared numbervar with no luck...I am not sure what I am doing wrong.

WhilePrintingRecords;
Shared numbervar H:=0;
 
Without knowing the exact structure of the report it is difficult to assist.

Please provide details of grouping, location of sub-reports, and some sample data showing the results you are getting and the results you expect.


Cheers
Pete
 
Sorry, I am new to any forum and Crystal Reports. I would like to attach a copy of the report design, but I can't seen to figure out how to do that, so here goes with how the report is designed:
RH-Contains criteria selected from system
PHa - Contains Company name, report name and etc.
PHb - Contains two sub-reports both reports are hidden and contain the following sections:
RHa
RHb
Detail
RFa
RFb - Contains the shared numbervar formula
GH1a - Contains much information and a sub-report, the sub-report has the following sections:
RHa
RHb
GH1
Detail
GF1 - Contains Shared Variable
RFa
RFb
GH1b - Contains title for detail section
Detail
GF1a - This is where the formula's are that use the shared numbervar's
GF1b - Sub-report for notes
GFIc - Sub-report for remarks.

I hope this helps.
The Newbie
 
The position is still unclear - sample data, current results and result you are looking for would have assisted here.

You are right, there is no provision for reports to be uploaded to this site. While it is not normal practice, I would be happy to take a look if you could share the report (with saved data) to Dropbox, Skydrive/Onedrive or similar and post the link here.

Otherwise you will need to provide much more detail, (including fields used for grouping, those that are used to link sub reports etc, plus the sample data, current results and result you are looking for). Please also explain what you mean when you say "The report works when you run one at a time, but not when you run it for a range of jobs."

Please remember we have absolutely no knowledge of your reporting environment, so you need o give us all of the information necessary to understand what you want.

Cheers
Pete
 
create a second Group 1 Footer, suppress it, put your reset formula in it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top