Jump to content
Henry Olive

Client Dataset Grouping

Recommended Posts

I wish everyone a healthy day.


MyDBGrid Looks Like Below ( I used Grouping in Client DataSet )

 

LINENO...ASSYNO....ITEMNO

-------------------------------

1..................ASSY1...........Item1

2..........................................Item2

3..........................................Item3

 

Now i need to get which LineNo's MAINASSY is empty ?

According to above sample LineNo1'S mainassy is not empty

but LineNo2 and LineNo3 are empty

I need something like  in OnDrawColumnCell event

if DBGrid1.Columns[1].Text = '' then .....

 

Thank You
 

 

 

 

 

 

Edited by Henry Olive

Share this post


Link to post
1 hour ago, Henry Olive said:

if DBGrid1.Columns[1].Text = '' then .....

 

You can check:

 

if VarIsNull(DBGrid1.Columns[1].Field.Value) then ....

Usually it's null not empty string or:

if DBGrid1.Columns[0].Field.AsString='' then

Share this post


Link to post

Thank you so much Lajos

Field.Value cant be null or Empty because in Dataset it has a value ,

but it is empty in DBGrid cause of CDS Grouping

The field's ONGETTEXT event there is below code

 if gbFirst in BOM.GetGroupState (1) then
    Text := Sender.AsString
  else
    Text := '';


Dataset Looks like below

ASSYNO.....ITEMNO

---------------------

Assy1..............ItemNo1

Assy1..............ItemNo2

Assy1..............ItemNo3

 

But DBGrid looks like (Cause of Grouping)

ASSYNO.....ITEMNO

---------------------

Assy1..............ItemNo1

..........................ItemNo2

..........................ItemNo3

 

I need Empty Columns that is Line2 and Line3

 


 

 

 

 

 

Share this post


Link to post

Oh, i think you want a "repoting function" called "suppress repeated values".

Most "report generators" comes with this functionality.

DevExpress Quantum grid ($$$) has similar stuff in different ways (merge cells, grouping, et.al).

Implementing it in a scrolling editable grid, i suspect, will not be very simple.

Do you load the complete grid or do you need "GridMode" or "Cached Updates"?

If you load all the grid data before displaying it, it should be easier to implement as you can check the actual data before painting.

You could check (instead of Null et al) for equality. If previous record <> match then draw otherwise supress.

I hope i did add confusion.

Share this post


Link to post

Thank you so much for your kind reply Dany

 

I solved my problem with below code

If Table1.FieldByName('ASSYNO').Text <> ''  then  ....

 

*In case of you use GROUPING in a ClientDataset*

with FieldByName(...).TEXT,  you can check

if there is a value in Dataset but No Text in DBGrid's dataset's same field

 

Again thank you so much.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×