Solved

Total group count on a datawindow

Posted on 2009-05-18
2
2,139 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In our object-oriented world the class is a minimal unit, a brick for constructing our applications. It is an abstraction and we know well how to use it. In well-designed software we are not usually interested in knowing how objects look in memory. …
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 perform CRUD operations on a MySql database.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.

628 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