cancel
Showing results for 
Search instead for 
Did you mean: 

Using Subreport Totals In Main Report Chart

Former Member
0 Kudos

I have a supreport (in a main report group footer) that calculates totals which in turn I pass to a main report as shared variables. I want to add a chart to the main report (main report footer) that includes these shared values - is this possible?

Accepted Solutions (0)

Answers (1)

Answers (1)

abhilash_kumar
Active Contributor
0 Kudos

Hi Layne,

You actually cannot chart off a formula that contains shared variables.

Since you want the chart on the report footer of the Main Report, you would need to add another subreport here and add the chart in the subreport.

In the first subreport, where you generate the group totals, you would need to create a shared stringvar and accumulate all the totals and send it back to the Main Report. Something like this :

whileprintingrecords;

shared stringvar totals := totals + ">" + grouptotals;

Send this as a parameter to the second subreport and use a formula to split the totals according to the group numbers. Something like this:

stringvar final_total := split({?totals},">",groupnumber)

Use this formula as the 'Show Values' for the Chart and follow the similar process for the showing the 'On Change Of' records.

Make sure that the second subreport returns exactly the same number of groups as the 1st subreport and that they have the same record selection as well.

Let me know how this goes!

-Abhilash

Former Member
0 Kudos

Abhilash,

I now get the error " A subscript must be between 1 and the size of the array." in my charting subreport. I am passing the number of groups, and the two values (as concatenated strings) to this report, but the chart expert will only let me select one of the two concatenated variables for the 'On Change Of' field and neither for the 'Show values" field.

Any suggestions?

abhilash_kumar
Active Contributor
0 Kudos

Hi Layne,

Could you paste all the formulas here? I'll have a look at them and let you know.

Also, make sure the subreport is getting in exactly the required records only. So, use the split keyword to filter only those records coming from the Main report.

-Abhilash

Former Member
0 Kudos

Here is the formula:

local numbervar i:=1;

while i<={@Group} do

(stringvar final_total:=split({?Pm-@PS},">") <i>;

i:=i+1;

final_total<i>);

@Group is the number of groups that have been passed from the main report, and @PS is the string (passed from the main report) that I am need to split and chart. There is another string I need to do the same process with, but I am trying to get one working at the moment.