Skip to main content

Hi all,

I have a sorted grid with three colums. In first and second column I hold strings (e.g. lastname and firstname) in third column numeric data.

In last row of grid:

cell(last-row, 1) = spaces, cell(last-row, 2) = "Total", cell(last-row, 3) = sum(column3).

To be more clear my grid is something like that:

LastName FirstName Sales
Sparrow Jack 100.00
Lopez Jennifer 250.00
Total 350.00

I am trying to sort the grid by clicking the header of column1 and keeping the sum row always at the bottom.

I tried the following:

*
Form1-Gd-1-Ev-Msg-Begin-Sort.
   IF EVENT-DATA-1 = 1  
      INQUIRE Form1-Gd-1, LAST-ROW = WS-LAST-ROW
      MOVE HIGH-VALUES TO WS-TMP
      MODIFY Form1-Gd-1(WS-LAST-ROW, EVENT-DATA-1) CELL-DATA = WS-TMP
   END-IF
.
*
Form1-Gd-1-Ev-Msg-Finish-Sort.
   IF EVENT-DATA-1 = 1  
      MOVE SPACES TO WS-TMP
      MODIFY Form1-Gd-1(WS-LAST-ROW, EVENT-DATA-1) CELL-DATA = WS-TMP
   END-IF
.

Normaly, when clicking a heading, grid is sorted ascending then after another click, descending etc.

The above code worked only for the first heading click: grid was sorted and sum row kept it's position. But second heading click that should sort the grid descending left the grid unchanged.

Version is 9.2.0

Thank you 

Hi all,

I have a sorted grid with three colums. In first and second column I hold strings (e.g. lastname and firstname) in third column numeric data.

In last row of grid:

cell(last-row, 1) = spaces, cell(last-row, 2) = "Total", cell(last-row, 3) = sum(column3).

To be more clear my grid is something like that:

LastName FirstName Sales
Sparrow Jack 100.00
Lopez Jennifer 250.00
Total 350.00

I am trying to sort the grid by clicking the header of column1 and keeping the sum row always at the bottom.

I tried the following:

*
Form1-Gd-1-Ev-Msg-Begin-Sort.
   IF EVENT-DATA-1 = 1  
      INQUIRE Form1-Gd-1, LAST-ROW = WS-LAST-ROW
      MOVE HIGH-VALUES TO WS-TMP
      MODIFY Form1-Gd-1(WS-LAST-ROW, EVENT-DATA-1) CELL-DATA = WS-TMP
   END-IF
.
*
Form1-Gd-1-Ev-Msg-Finish-Sort.
   IF EVENT-DATA-1 = 1  
      MOVE SPACES TO WS-TMP
      MODIFY Form1-Gd-1(WS-LAST-ROW, EVENT-DATA-1) CELL-DATA = WS-TMP
   END-IF
.

Normaly, when clicking a heading, grid is sorted ascending then after another click, descending etc.

The above code worked only for the first heading click: grid was sorted and sum row kept it's position. But second heading click that should sort the grid descending left the grid unchanged.

Version is 9.2.0

Thank you 

Are you using the 9.2 enhancement for sortable grid columns,meaning have you defined   sort-types  in your grid. It seems so, I don't see where you are defining the event-action .... EVENT-ACTION determines  how the control responds:

EVENT-ACTION-NORMAL (the default) – the grid’s records are sorted by the column

EVENT-ACTION-COMPLETE – nothing further happens.  You can use this to provide a custom sort procedure by emptying the grid and reloading it in the desired order.  

EVENT-ACTION-FAIL – same effect as EVENT-ACTION-COMPLETE

One other option would be to have the last row be a separate grid or series of entry-fields, so that this separartes te data that can be re-ordered and the totals.


Hi all,

I have a sorted grid with three colums. In first and second column I hold strings (e.g. lastname and firstname) in third column numeric data.

In last row of grid:

cell(last-row, 1) = spaces, cell(last-row, 2) = "Total", cell(last-row, 3) = sum(column3).

To be more clear my grid is something like that:

LastName FirstName Sales
Sparrow Jack 100.00
Lopez Jennifer 250.00
Total 350.00

I am trying to sort the grid by clicking the header of column1 and keeping the sum row always at the bottom.

I tried the following:

*
Form1-Gd-1-Ev-Msg-Begin-Sort.
   IF EVENT-DATA-1 = 1  
      INQUIRE Form1-Gd-1, LAST-ROW = WS-LAST-ROW
      MOVE HIGH-VALUES TO WS-TMP
      MODIFY Form1-Gd-1(WS-LAST-ROW, EVENT-DATA-1) CELL-DATA = WS-TMP
   END-IF
.
*
Form1-Gd-1-Ev-Msg-Finish-Sort.
   IF EVENT-DATA-1 = 1  
      MOVE SPACES TO WS-TMP
      MODIFY Form1-Gd-1(WS-LAST-ROW, EVENT-DATA-1) CELL-DATA = WS-TMP
   END-IF
.

Normaly, when clicking a heading, grid is sorted ascending then after another click, descending etc.

The above code worked only for the first heading click: grid was sorted and sum row kept it's position. But second heading click that should sort the grid descending left the grid unchanged.

Version is 9.2.0

Thank you 

Hi,

I deal with this issue in a slightly different way by using a heading row for the totals.  That way, no matter how large your grid is, the totals are always visible, regardless of how the user chooses to sort the grid.

Regards,

Ian


Hi all,

I have a sorted grid with three colums. In first and second column I hold strings (e.g. lastname and firstname) in third column numeric data.

In last row of grid:

cell(last-row, 1) = spaces, cell(last-row, 2) = "Total", cell(last-row, 3) = sum(column3).

To be more clear my grid is something like that:

LastName FirstName Sales
Sparrow Jack 100.00
Lopez Jennifer 250.00
Total 350.00

I am trying to sort the grid by clicking the header of column1 and keeping the sum row always at the bottom.

I tried the following:

*
Form1-Gd-1-Ev-Msg-Begin-Sort.
   IF EVENT-DATA-1 = 1  
      INQUIRE Form1-Gd-1, LAST-ROW = WS-LAST-ROW
      MOVE HIGH-VALUES TO WS-TMP
      MODIFY Form1-Gd-1(WS-LAST-ROW, EVENT-DATA-1) CELL-DATA = WS-TMP
   END-IF
.
*
Form1-Gd-1-Ev-Msg-Finish-Sort.
   IF EVENT-DATA-1 = 1  
      MOVE SPACES TO WS-TMP
      MODIFY Form1-Gd-1(WS-LAST-ROW, EVENT-DATA-1) CELL-DATA = WS-TMP
   END-IF
.

Normaly, when clicking a heading, grid is sorted ascending then after another click, descending etc.

The above code worked only for the first heading click: grid was sorted and sum row kept it's position. But second heading click that should sort the grid descending left the grid unchanged.

Version is 9.2.0

Thank you 

we also use num-col-headings and place the sum in the heading.

Footer like in html tables would be nice in acu tables :)