Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Total group count on a datawindow

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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

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. …
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: …
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.

705 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