On the toolbar I have a button to trigger a procedure on all selected rows within a child band of an ultraGrid.
How can I loop through the ultraGrid to read each selected row to run a procedure on values I read from each selected row in this Grid?
Hope someone can help me on this. Lot of post are unclear on looping through rows of UltraGrids.
How can you run through each row and test the property selected and than read it to process on it?
Kind regards,
Peter Wokke
On the toolbar I have a button to trigger a procedure on all selected rows within a child band of an ultraGrid.
How can I loop through the ultraGrid to read each selected row to run a procedure on values I read from each selected row in this Grid?
Hope someone can help me on this. Lot of post are unclear on looping through rows of UltraGrids.
How can you run through each row and test the property selected and than read it to process on it?
Kind regards,
Peter Wokke
Flag this post as spam/abuse.
Hi Mike,
Thank you kindly. How can I capture this list of selected items. I have tried to capture it into a RowsCollection object.
But this is not possible: incompatible data type in expression or assignment.
To what kind of object can I assign this ultraGrid1:Selected:Rows so I can process on each item of it?
Kind regards,
Peter.
You can do something like ....
DEFINE VARIABLE oEnum# AS Infragistics.Win.UltraWinGrid.RowEnumerator NO-UNDO.
ASSIGN
oEnum# = UltraGrid:SELECTED:Rows:GetEnumerator()
.
DO WHILE oEnum#:MoveNext():
REPOSITION-TO-ROW(oEnum#:Current:ListIndex + 1).
END.
Richard,
Thank you kindly for this clear example. There are so many properties on those UltraControl objects and this RowEnumerator can be used well. Will do some more research on this.
Have found out the following solution to capture the selected rows and process them one by one:
define variable clsSelectedRows as SelectedRowsCollection no-undo.
define variable clsCurrentRow as UltraGridRow no-undo.
define variable clsCells as CellsCollection no-undo.
define variable clsCell as UltraGridCell no-undo.
define variable iOrderNumber as integer no-undo.
define variable iOrderLine as integer no-undo.
define variable iPackings as integer no-undo.
clsSelectedRows = ultraGridShipment:Selected:Rows.
do iIndex = 0 to clsSelectedRows:count - 1 :
clsCurrentRow = clsSelectedRows[iIndex].
if clsCurrentRow:Band:Key = "ttReceiptLines" then do:
clsCells = clsCurrentRow:Cells.
clsCell = clsCells:item["OrderNumber"].
iOrderNumber = integer(clsCell:Text).
clsCell = clsCells:item["LineNumber"].
iOrderLine = integer(clsCell:Text).
clsCell = clsCells:item["Packings"].
iPackings = integer(clsCell:Text).
message "Receipt line is: " iOrderNumber iOrderLine
skip "Number of packings is :" iPackings
view-as alert-box.
end.
end.
It is all about using the right property of an object.
And there are more than one.
Wirt kind regards,
Peter Wokke
Hi Richard, playing with .NET Enumerators:
{Consultingwerk/foreach.i UltraGridRow oRow in ultraGrid1:Selected:Rows}
REPOSITION-TO-ROW(oRow:ListIndex + 1).
END.
Thanks Mike!
A great contradication in the war .. I mean, debate against includes :)