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

DataGrouping ColumnName
https://forum.ehlib.com/en/viewtopic.php?f=5&t=633
Page 1 of 1

Author:  zxqwas [ 03 Dec 2015, 09:37 ]
Post subject:  DataGrouping ColumnName

Hi,
how i can get (in RunTime) the name of column, wich was used for create the GropLevel?
WBR, Igor

Author:  bestwail [ 06 Dec 2015, 17:25 ]
Post subject:  Re: DataGrouping ColumnName

First:
create one or more Grouplevels in design mode.

Second:
if you have 3 columns for example and 1 level, you can put this code

Code:
DBGridEh1.DataGrouping.GroupLevels.Items[0].Column := Grid2.Columns[0];  //-------> for column 1

or
Code:
DBGridEh1.DataGrouping.GroupLevels.Items[0].Column := Grid2.Columns[1];  //-------> for column 2

or
Code:
DBGridEh1.DataGrouping.GroupLevels.Items[0].Column := Grid2.Columns[2];  //-------> for column 3


and don't miss

Code:
DBGridEh1.DataGrouping.Active := true;

Author:  zxqwas [ 07 Dec 2015, 09:21 ]
Post subject:  Re: DataGrouping ColumnName

Thank you for reply,
but i need to get (in RunTime) the field name(s) from already created group(s).
For example
DBGridEh1.DataGrouping.GroupLevels.Items[0].Column.Name,
but i can't find the 'Name', 'ColumnName' or 'FieldName' properties in 'DataGrouping'

Author:  bestwail [ 08 Dec 2015, 15:39 ]
Post subject:  Re: DataGrouping ColumnName

The code above is for a runtime mode

You can change the group level in runtime
1/ by the position of the column:
DBGridEh1.DataGrouping.GroupLevels.Items[0].Column := Grid2.Columns[n];
or
DBGridEh1.DataGrouping.GroupLevels[0].Column := Grid2.Columns[n];
// n is the position of the column in the grid

2/ by the field name:
DBGridEh1.DataGrouping.GroupLevels.Items[0].Column := Grid2.FindFieldColumn('the field name');

if you like to get the FieldName of the current grouplevel put simply:
TColumnEh(DBGridEh1.DataGrouping.GroupLevels[0].Column).FieldName

Example:
ShowMessage(TColumnEh(DBGridEh1.DataGrouping.GroupLevels[0].Column).FieldName);

Author:  blumache [ 19 Jul 2019, 08:30 ]
Post subject:  Re: DataGrouping ColumnName

Please help me with the same problem, but in C++

I try to find the name of the columns from DataGrouping!!

Please give me a litle example!

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