Solved

Total group count on a datawindow

Posted on 2009-05-18
2
2,092 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
easiest way to find port number 12 114
HTML/Webpage Editor for Windows 10 20 193
missing "main" in Java on Eclipse 4 82
Delphi : could not find program, '...exe' 2 243
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. …
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: …
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 use and create new code templates in NetBeans IDE 8.0 for Windows.

751 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