R – trying to subtract one subreport value from another subreport value

crystal-reports

I have a crystal report called BPCTaskReportV3. I have a subreport called totalworkflowsum, with formula called @wfssubmitted, which contains:

WhilePrintingRecords;
Shared NumberVar totalwfs;

totalwfs := DistinctCount ({Reviewers_ALL_Table_BE.WorkflowID})

Another subreport is called NoReviewWorkflows, with a formula called @noreview, which contains:

WhilePrintingRecords;
Shared NumberVar noreviewwfs;

noreviewwfs := DistinctCount ({Reviewers_ALL_Table_BE.WorkflowID})

I need to subtract the total of @noreview from @wfssubmitted. In order to do this, I've created a formula called @mytotal, which contains:

WhilePrintingRecords;
Shared NumberVar mytotal;
mytotal={BPCTaskReportV3.totalworkflowssum.totalwfs}-{BPCTaskReportV3.NoReviewWorkflows.noreviewwfs}

I'm getting the error message 'this field name is not known' for BPCTaskReportV3.totalworkflowssum.totalwfs. I've tried other variations of this, such as BPCTaskReportV3.totalwfs and totalworkflowssum.totalwfs and BPCTaskReportV3.totalwfs. Is there another syntax I shoulde be using?

Best Answer

I do not believe that you need to specify the subreport name. Since this is a shared variable I believe that you should be able to create a formula that uses the same name as the shared variables. So in this case @mytotal look like the following:

WhilePrintingRecords; 
Shared NumberVar totalwfs;
Shared NumberVar noreviewwfs;

totalwfs - noreviewwfs;

Hope it helps.

EDIT: This is an edit in response to the comments. Try the below to see if you are able to pull the value of totalwfs by itself without the subtraction.

Shared NumberVar totalwfs;

totalwfs;
Related Topic