Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 953
  • Last Modified:

Counting and Totaling Subreport's Records

Hi there,

I am using CR10

Here is my report layout

ReportHeader  - Suppresed
PageHeader    - Retort Title & Column headers
GroupHeader1  - Group 1 Name
GroupHeader2  - Group 2 Name
Details a          - records from Parent table
                        -----------------------------------------
Details b          - Subreport with records in Child table   - Suppressed if empty
                        -----------------------------------------
GroupFooter2    Total record count in Parent table - Total record count in Child table for Group1
GroupFooter1    Total record count in Parent table - Total record count in Child table for Group2
ReportFooter     GranTotal record count in Parent table - GrandTotal record count in Child table
PageFooter

I have a problem displaying totals fotr Child table (in main report not in subreport)
Please Help
VERY URGENT!!!

Thanks
0
Michael_D
Asked:
Michael_D
  • 6
  • 5
2 Solutions
 
AlThePal7Commented:
Is your problem passing data from the subreport to the main report?  If so the following link may help: http://support.businessobjects.com/library/kbase/articles/c2007600.asp
0
 
Michael_DAuthor Commented:
AlThePal7,

I am using shared var to pass the count from subreport to main report but if there is no records in Child table  the shared var doesn't set to zero - it shows previous count.


0
 
mlmccCommented:
Where are your variables declared?

What formulas are used?

mlmcc
0
Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

 
Michael_DAuthor Commented:
I actually solved problem with clearing the variable but now i don't know how to Total the value.
Here what i got so far:

//@Child_count_init
//Location: Main report's Header
Shared Numbervar Child_count:=0
//----------------


//@Child_count_subreport
//Location: Subreport's Footer
WhilePrintingRecords;
Shared Numbervar Child_count:= Count ({Child_Table.FieldName})
//----------------


//@Child_Count_display
//Location: Detail c - after Subreport
WhilePrintingRecords;
Shared Numbervar Child_count;
Child_count
//----------------

//@Child_count_clear
//Location: Detail d - (after @Child_count_disp)  
WhilePrintingRecords;
Shared Numbervar Child_count:=0;
//----------------


As you can see I have added 2 more detail sections - one for display the total returned by subreport and other to set the variable to zero immidiatelly after displaying.

Now i tryed to total @Child_Count_display but it doesnt appears in the available fields list.
What i am doing wrong?

0
 
mlmccCommented:
Try changing these

//@Child_count_init
//Location: Main report's Header
Shared Numbervar Child_count:=0
GLOBAL NUMBERVAR CHILD_COUNT_TOTAL := 0;
//----------------

//@Child_Count_display
//Location: Detail c - after Subreport
WhilePrintingRecords;
Shared Numbervar Child_count;
GLOBAL NUMBERVAR CHILD_COUNT_TOTAL := 0;
CHILD_COUNT_TOTAL := CHILD_COUNT_TOTAL + CHILD_COUNT;
Child_count
//----------------

mlmcc
0
 
mlmccCommented:
Also if you want you can delete detail d and put the formula in detail a

//@Child_count_clear
//Location: Detail a - (Before @Child_count_disp)  
WhilePrintingRecords;
Shared Numbervar Child_count:=0;
//----------------

mlmcc
0
 
Michael_DAuthor Commented:
Thanks a lot mlmc:

Seems like I solved it by creating additional formulas like this:

//@Child_count_init
//Location: Main report's Header
Shared Numbervar Child_count:=0;
Shared Numbervar Child_sub_total1:=0;
Shared Numbervar Child_sub_total2:=0;
Shared Numbervar Child_grand_total:=0;
//----------------

//@Child_count_increment
//Location: Detail c - after Subreport
Shared Numbervar Child_count;
Shared Numbervar Child_sub_total1;
Shared Numbervar Child_sub_total2;
Shared Numbervar Child_grand_total;
Child_sub_total1:=Child_sub_total1+Child_count;
Child_sub_total2:=Child_sub_total2+Child_count;
Child_grand_total:=Child_grand_total+Child_count;
//----------------

//@Child_count_subreport
//Location: Subreport's Footer
WhilePrintingRecords;
Shared Numbervar Child_count:= Count ({Child_Table.FieldName})
//----------------


//@Child_Count_display
//Location: Detail c - after Subreport
WhilePrintingRecords;
Shared Numbervar Child_count;
Child_count
//----------------

//@Child_count_clear
//Location: Detail d - (after @Child_count_disp)  
WhilePrintingRecords;
Shared Numbervar Child_count:=0;
//----------------


//Subtotal1_display
//Location: GF1-a
Shared Numbervar Child_sub_total1;
Child_sub_total1
//----------------


//Subtotal1_clear
//Location: GF1-b
Shared Numbervar Child_sub_total1:=0;
//----------------

//Subtotal2_display
//Location: GF2-a
Shared Numbervar Child_sub_total2;
Child_sub_total2
//----------------

//Subtotal2_clear
//Location: GF2-b
Shared Numbervar Child_sub_total2:=0;
//----------------


//GrandTotal_display
//Location: RF
Shared Numbervar Child_grand_total;
Child_grand_total
//----------------


I cant believe that there is no easy way to do it.  


If some body knows how to improve this please let me know.
Otherwise I will split the points between both of you guys.
Thank you very much for help
0
 
mlmccCommented:
Have you tried using the SUMMARY functions

Right click the field on the report and click SUMMARY
You can then mve the summary to the appropriate footer

mlmcc
0
 
Michael_DAuthor Commented:
yes i tried - summary is not available for formula fields.

Right click ->insert menu shows only "Field Heading".  there is no "summary"  like for regular field
0
 
mlmccCommented:
You could try using Running Totals

mlmcc
0
 
Michael_DAuthor Commented:
Same thing - doesn't allow if formula contains shared var (i guess)
0
 
mlmccCommented:
That may be the most efficient solution.

As I stated above, yoy can put the reset to 0 in Detail A or in this case in the Group header

mlmcc
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

  • 6
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now