Solved

Total group count on a datawindow

Posted on 2009-05-18
2
1,971 Views
Last Modified: 2013-12-26
Is there a way to get the total number of groups on a datawindow? Something like dw_data.Describe(Datawidow.group.count) or something similar?
0
Comment
Question by:byteboy11
2 Comments
 
LVL 18

Accepted Solution

by:
diasroshan earned 250 total points
ID: 24419228
Hi,

Put this script in the RetrieveEnd event of your DataWindow or DataStore to count the initial number of group breaks for the number of the group for which you are searching. Groups are numbered in the order that you define them. Anytime the group is recalculated this count should be repeated.


long l_rownum = 1
long l_TotalGroupBreaks = 0

do while l_rownum > 0
   l_rownum = this.FindGroupChange(l_rownum + 1, 1)

   // The FindGroupChange function searches for the next break for the specified group. A
   // group break occurs when the value of the column for the group changes. In the above
   // use of the FindGroupChange function the number of breaks for group level 1 is totalled.

   l_TotalGroupBreaks++
loop

Cheers,
Rosh
0
 
LVL 14

Expert Comment

by:sandeep_patel
ID: 24422974
if you are not looking for generic approach and specific to one or two datawindows then I would recommend below. Because writing a code in rerieveend will always slower your performance where there are lots of data to retrieve.

1. Say your datawindow has group on region. Now put below computed column cf_groups in detail band
cumulativesum ( if (region = region[-1] , 0 , 1) for all)
2. in your code get the value by
dw_1.object.cf_groups[dw_1.rowcount())

Regards,
Sandeep
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now