views:

346

answers:

1

Hi, 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?

A: 

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;
Dusty
I changed @mytotal to be:WhilePrintingRecords;Shared NumberVar totalwfs;Shared NumberVar noreviewwfs;mytotal=totalwfs - noreviewwfs;This produced no errors when I ran the checker, but it returns as 'false' when I run the report. I was expecting it to return a number. Should I need to redeclare totalwfs and noreviewwfs since those were declared in separate subreports?
No, you need to declare them in both formulas (the subreport and in the main report). I believe that you are getting the true or false because you have mytotal=totalwfs - noreviewwfs. This is a boolean response. If you changed it to totalwfs - noreviewwfs and took out the mytotal or put mytotal=totalwfs - noreviewwfs; mytotal; you'd be telling the formula to return the number instead.
Dusty
thanks...this now returns 0.00. The subreport formulas are retrieving and saving their values just fine (totalwfs may be 253 and noreviewwfs may be 6) - but they're not playing together well.
You may try to put the mytotal formula field in the report footer to see if it could be something with where the data is being printed. This would take the whileprintingrecords out of the equation so you can see if the numbervar is being updated. If this doesn't help can you post where you are putting the subreports and the formulas on the report?
Dusty
Tried putting the @mytotal in the footer - both with and without whileprintingrecords. Both times, it displayed 0.00. The subreports are in Report Header a and I had originally put @mytotal in Report Header b.
Try to put only shared numbervar totalwfs; totalwfs; to see if it returns the correct value from the subreport. I've tested it on my system and this should work.
Dusty
the main formula does the subtraction...did you mean to just make mytotal=totalwfs? I tried this; it didn't display the value for totalwfs... What is contained in your version of mytotal and totalwfs?
Instead of doing mytotal = totalwfs just declare totalwfs as a shared variable and put totalwfs; See my edit to my answer.
Dusty