Components for Delphi and C++ Builder.

Go to Russian forum
Go to EhLib.com
It is currently 28 Mar 2024, 12:06

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: DataGrouping ColumnName
PostPosted: 03 Dec 2015, 09:37 
Offline

Joined: 03 Dec 2015, 09:31
Posts: 2
Hi,
how i can get (in RunTime) the name of column, wich was used for create the GropLevel?
WBR, Igor


Top
 Profile  
 
PostPosted: 06 Dec 2015, 17:25 
Offline

Joined: 21 May 2012, 12:29
Posts: 9
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;


Top
 Profile  
 
PostPosted: 07 Dec 2015, 09:21 
Offline

Joined: 03 Dec 2015, 09:31
Posts: 2
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'


Top
 Profile  
 
PostPosted: 08 Dec 2015, 15:39 
Offline

Joined: 21 May 2012, 12:29
Posts: 9
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);


Top
 Profile  
 
PostPosted: 19 Jul 2019, 08:30 
Offline

Joined: 31 Jan 2013, 13:05
Posts: 17
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!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 52 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group