pro_imaj Posted November 1, 2020 Share Posted November 1, 2020 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. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted November 1, 2020 Share Posted November 1, 2020 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? Quote Link to comment Share on other sites More sharing options...
pro_imaj Posted November 1, 2020 Author Share Posted November 1, 2020 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. Quote Link to comment Share on other sites More sharing options...
x11 Posted November 2, 2020 Share Posted November 2, 2020 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; 1 Quote Link to comment Share on other sites More sharing options...
x11 Posted November 2, 2020 Share Posted November 2, 2020 \Demos\Desktop\GridGroupingSummary \Demos\Desktop\GridGroupingSummaryGrandTotal Quote Link to comment Share on other sites More sharing options...
pro_imaj Posted November 2, 2020 Author Share Posted November 2, 2020 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; 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. Quote Link to comment Share on other sites More sharing options...
x11 Posted November 2, 2020 Share Posted November 2, 2020 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; Quote Link to comment Share on other sites More sharing options...
M.Ammar Posted November 3, 2020 Share Posted November 3, 2020 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 1 Quote Link to comment Share on other sites More sharing options...
pro_imaj Posted November 3, 2020 Author Share Posted November 3, 2020 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.