EhLib.Com
http://forum.ehlib.com/en/

DBGrid-DataGrouping: Get amount of Nodes
http://forum.ehlib.com/en/viewtopic.php?f=5&t=1071
Page 1 of 1

Author:  innovateAdmin [ 15 Feb 2021, 14:21 ]
Post subject:  DBGrid-DataGrouping: Get amount of Nodes

Hi,
I am new to the forum and have a question:

In a DBGridEh with DataGrouping.Active = True and GroupLevel[0] = ColumnName I want to know how many different "Nodes" are in the table. For further information please look to the file.

Thanks for your help!

Attachments:
File comment: For example here are 14 Countries in the table (Bahamas, Belize, Bermuda, ...)
Unbenannt.PNG
Unbenannt.PNG [ 18.38 KiB | Viewed 187 times ]

Author:  EhLibSupport [ 17 Feb 2021, 04:07 ]
Post subject:  Re: DBGrid-DataGrouping: Get amount of Nodes

Hello

You can use DBGridEh.DataGrouping.GroupDataTree property to access Grouping Tree.

And use next code to get number of records in the top-level groupings

Code:
procedure TfrDataGrouping.Button1Click(Sender: TObject);
begin
  ShowMessage('The number of records in the top-level groupings - ' +
    DBGridEh1.DataGrouping.GroupDataTree.Root.Count.ToString);
end;

Author:  innovateAdmin [ 17 Feb 2021, 08:13 ]
Post subject:  Re: DBGrid-DataGrouping: Get amount of Nodes

Thanks for your support. This is not working for me, the result of DBGridEh1.DataGrouping.GroupDataTree.Root.Count is 0.
Maybe, something is wrong in my project?
In DBGridEh DataGrouping active is true, there is one grouplevel DBGridEh1.DataGrouping['ArtNr'] with the columnname Column_5_ArtNr.
Is there something to configure in the MemTable?

Gerd

Author:  EhLibSupport [ 17 Feb 2021, 08:41 ]
Post subject:  Re: DBGrid-DataGrouping: Get amount of Nodes

Hello

Try to test in project MainDemo,
frame - FrameDataGrouping.

Attachments:
sshot-172.png
sshot-172.png [ 41.18 KiB | Viewed 182 times ]

Author:  innovateAdmin [ 17 Feb 2021, 13:04 ]
Post subject:  Re: DBGrid-DataGrouping: Get amount of Nodes

Hm, I am on 10.0.30 and it's 0
Attachment:
GroupDataTree.Root.Count.PNG
GroupDataTree.Root.Count.PNG [ 63.39 KiB | Viewed 180 times ]

Same result on 10.0.31 (just updated).

Any idea?

Author:  EhLibSupport [ 17 Feb 2021, 21:06 ]
Post subject:  Re: DBGrid-DataGrouping: Get amount of Nodes

Hello

Make sure you are accessing the correct DBGirdEh with Grouping.
Judging by the screenshot, you have placed the button on the Form1 form where DBGridEh1 is a grid with a list of Demo frames.
Place the button on TfrDataGrouping (unit FrameDataGrouping).

Author:  innovateAdmin [ 18 Feb 2021, 07:50 ]
Post subject:  Re: DBGrid-DataGrouping: Get amount of Nodes

:oops: my mistake ...
Now I have to find the difference between my project and datagrouping in the demo. :roll:

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/