Create Text Summary in Group Footer

Stimulsoft Reports.WEB discussion
Post Reply
Calara
Posts: 2
Joined: Thu Feb 11, 2021 12:22 pm

Create Text Summary in Group Footer

Post by Calara »

Hello Stimulsoft

I'm struggling to create a single summary line in a group footer.

I have a data band containing a panel. Inside this panel I have 3 further data bands which are linked to other tables with the data relationships set to the linking fields and the Master Component set back to the outer data band. This is working as expected - information from the master data band is printed, followed by selected data from the additional tables.

My problem is that one of these second level data bands contains multiple records for each master item, and the specification calls for a single line output which is a summary of all of the records.

For example say there are 3 records:-

index Master Index Information
1 1 GEO BAR
2 1 GEO BAR
3 1 NULL

The specification calls for a single text line that reads 'GEO BAR'

My thinking is to use a group - so I've added a group header - height zero - grouped by Master Index. The actual data band will have no components, and then a group footer to hold a text component with the result. I then created a report variable and in the Data Bands Before Print event added code to check the the current record doesn't already exist, and if not add 'Information' to the variable. Therefore when the group footer is printed the variable will hold the data I need.

I was hoping the logic would run;
Group Header - process records for Master Index 1
Record 1 - Variable = '' Information = 'GEO BAR' so add 'GEO BAR' to variable as it doesn't already exist. Variable = Variable + Information.
Record 2 - Variable = 'GEO BAR' Information = 'GEO BAR' - 'GEO BAR' already exists in the variable - so skip this record.
Record 3 - Variable = 'GEO BAR' Information IS NULL - nothing to do here.
Group Footer - Variable = 'GEO BAR' - Print Variable (ie. GEO BAR)

Does this sound like it should work?

What I'm finding is that the variable isn't being populated. If I replace the database field ('Information' in the above) with a hard coded string in the 'Before Print' event of the data band and print it to the data band - I'm seeing the Before Print event fire once for every record in the outer data set, and then output to the data band one per inner record.

Is there a better way to do this?
Am I asking too much of the report software?

I've spent over a day on this so far and I'm getting nowhere - any suggestions would be much appreciated.

Regards

Rod
Lech Kulikowski
Posts: 6237
Joined: Tue Mar 20, 2018 5:34 am

Re: Create Text Summary in Group Footer

Post by Lech Kulikowski »

Hello,

Please send us a sample report with test data that reproduces the issue for analysis.

Thank you.
Calara
Posts: 2
Joined: Thu Feb 11, 2021 12:22 pm

Re: Create Text Summary in Group Footer

Post by Calara »

Not too easy to send you an entire database - but not to worry, I adopted a 'sledgehammer' approach instead and added separate data bands with groups for each field. This works, but is pretty basic I think because your grouping is too loose.

Thanks for your time.
Lech Kulikowski
Posts: 6237
Joined: Tue Mar 20, 2018 5:34 am

Re: Create Text Summary in Group Footer

Post by Lech Kulikowski »

Hello,

Thank you for the information.
Post Reply