martes, 3 de mayo de 2016

[JD Edwards] Loop All Grid Rows

A lot of times we'll need looping all grid rows, for example, for update a grid column, save the rows in a auxiliar table, etc. It's easy if we use system functions:

Get Max Grid Rows(FC Grid, Total_Rows) -> This system function returns total grid rows in the second parameter for the grid indicated as the first parameter.

Get Grid Row(FC Grid, RowId) -> This system function returns the GC values for the line id number indicated as the second parameter.


And with this functions, we'll doing a loop to iterate above all rows, and a variable for current row where we initialized to 1 and increase by 1 on each iteration (previously checking that there are lines in grid)






Example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
VA frm_55_CurrentRow_MATH01 = 1
Get Max Grid Rows(FC Grid, VA frm_55_TotalRows_MATH01)
If VA frm_55_TotalRows_MATH01 is not equal to <Zero>
While VA frm_55_CurrentRow_MATH01 is less than or equal to VA frm_55_TotalRows_MATH01
  Get Grid Row(FC Grid, VA frm_55_CurrentRow_MATH01)
  //
  // Works with row
  //
  GC CatCod1 = FC CatCod1
  //
  F4211.Update
  GC Order Co = TK Order Company (Order Number)
  GC Order Number = TK Document (Order No, Invoice, etc.)
  GC Or Ty = TK Order Type
  GC Line Number = TK Line Number
  VA frm_55_SecuencialFiltro_JOBN -> TK Work Station ID
  //
  VA frm_55_CurrentRow_MATH01 = [VA frm_55_CurrentRow_MATH01]+1
 End While
End If

5 comentarios:

  1. I am using the GetGridRow system function it is clearing all the variables blank

    ResponderEliminar
  2. I am using the GetGridRow system function it is clearing all the variables blank, is it possible or m i passing wrong variable with wrong type. I have used both intger and mathnumeric also passed 8,9 as a literal value but is taking the the 8 row number because next time variables are cleared

    ResponderEliminar
    Respuestas
    1. Could you put your code here please? in what event do you are iterating? if you initialize your variable as 1, and you are iterating about all rows (previous variable count all rows grid), you pass your grid and iterating variable to Get Grid Row function, it should return all grid columns into GC.

      Eliminar