Jump to content

UniDBGrid Is there a way to do standard jobs in batches? Sort, Filter, Subtotal (Sum, AVG, Count)


pro_imaj

Recommended Posts

Hi,

In big projects with Unigui;

Is there a standard way to do Sort, Subtotal operations (SUM, AVG, Count) and Filter all fields for each Grid component?

Currently, it is struggling to do these operations one by one for each grid, I want to know if there is a way to do this.

Thank you.

Link to comment
Share on other sites

3 minutes ago, pro_imaj said:

In big projects with Unigui;

Is there a standard way to do Sort, Subtotal operations (SUM, AVG, Count) and Filter all fields for each Grid component?

Currently, it is struggling to do these operations one by one for each grid, I want to know if there is a way to do this.

Hello,

Can you please explain in more details?

Link to comment
Share on other sites

7 minutes ago, Sherzod said:

Merhaba,

Lütfen daha detaylı açıklar mısınız?

As a standard when I add Grid to projects.
I do filtering for all fields, A-Z Sort for all fields, SUM for some fields and Count for some fields, I do this for all grids I add to the project.

The Datasource they are connected to is different and therefore different on the foreheads.

For example; I do many things such as putting an edit on the hidden panel for the filter in each field and then selecting it in the relevant field, and this is both tedious and time consuming.

I want to find out if there is a way to do these operations in a shorter time, I'm dealing with too many grids now and these processes take a long time.

For example; To ignore Delphi VCL cxGrid subtotals, right click Sum with your mouse is enough.

Thank you.

Link to comment
Share on other sites

13 hours ago, pro_imaj said:

Is there a standard way to do Sort, Subtotal operations (SUM, AVG, Count) and Filter all fields for each Grid component?

 

No.

Use OnColumnSummaryResult + property Summary.

Show record count in column "ID":

procedure TfmMain.dbgTodayColumnSummaryResult(Column: TUniDBGridColumn; GroupFieldValue: Variant; Attribs: TUniCellAttribs;
  var Result: string);
begin
  if SameText(Column.FieldName, 'ID') then
    Result := qToday.RecordCount.ToString;
end;

 

Screenshot_18.jpg

  • Like 1
Link to comment
Share on other sites

1 hour ago, x11 said:

 

No.

Use OnColumnSummaryResult + property Summary.

Show record count in column "ID":


procedure TfmMain.dbgTodayColumnSummaryResult(Column: TUniDBGridColumn; GroupFieldValue: Variant; Attribs: TUniCellAttribs;
  var Result: string);
begin
  if SameText(Column.FieldName, 'ID') then
    Result := qToday.RecordCount.ToString;
end;

 

Screenshot_18.jpg

Thanks for the answer.

How can I tie all of these operations to a standard, can I standardize dealing with each form separately. I wanted to know this.

Link to comment
Share on other sites

Try write a common procedure for all grids and use it:

procedure CommonColumnSummaryResult(UniDBGrid: TUniDBGrid; Column: TUniDBGridColumn; GroupFieldValue: Variant; Attribs: TUniCellAttribs; var Result: string);
begin
  if SameText(Column.FieldName, 'ID') then
    Result := qToday.RecordCount.ToString;  
end;


// use
procedure TfmMain.dbgTodayColumnSummaryResult(Column: TUniDBGridColumn; GroupFieldValue: Variant; Attribs: TUniCellAttribs;
  var Result: string);
begin
  CommonColumnSummaryResult(dbgToday, Column, GroupFieldValue, Attribs, Result);
end;

 

Link to comment
Share on other sites

23 hours ago, pro_imaj said:

Thanks for the answer.

How can I tie all of these operations to a standard, can I standardize dealing with each form separately. I wanted to know this.

Hi 

if I understand you correctly you need the same grid settings and operations  for many forms, I know this is simple solution but have you considered inheritance?

I mean one form as parent with some generic code for sorting and filtering etc.. , I use the same in my projects and it saves a lot of time only have to deal with some exceptions .

regards

  • Like 1
Link to comment
Share on other sites

4 hours ago, M.Ammar said:

Hi 

if I understand you correctly you need the same grid settings and operations  for many forms, I know this is simple solution but have you considered inheritance?

I mean one form as parent with some generic code for sorting and filtering etc.. , I use the same in my projects and it saves a lot of time only have to deal with some exceptions .

regards

Thank you.

Now I'm working through it.

Regards.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...