Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Total group count on a datawindow

Posted on 2009-05-18
2
Medium Priority
?
2,233 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 1000 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org Go to that link and select download selenium in the right hand column That will then direct you to their download page. From that p…
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.
Suggested Courses

916 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