In this post we're going see how loop selected grid rows when we have it set to "Multiple Select". It's very useful for example when we want see in a FC field the amount summatory of grid, or when we want process the selected lines in other form, or when we want process selected lines in a report, etc.
We need the next system functions:
Get Selected Grid Row Count(FC Grid, VA frm_SelectedCount_LNID) -> get total selected rows
Get Selected Grid Row Number(FC Grid, VA frm_GridRowNumber_INT01) -> get the first row selected
Get Grid Row(FC Grid, VA frm_GridRowNumber_INT01) -> get the row id value into GC
Get Next Selected Row(FC Grid, VA frm_GridRowNumber_INT01, VA frm_GridRowNumber_INT01) -> get the next selected row
For doing it, we get the total rows selected, if it's greater than 0, get the first row, get the GC values, process row and get the next selected row in a loop.
Example:
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
Example:
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
No hay comentarios:
Publicar un comentario