How to process through the selected rows from an UltraGrid

Posted by PeterWokke on 06-Jul-2015 09:03

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 

 

All Replies

Posted by Mike Fechner on 06-Jul-2015 09:27

ultraGrid1:Selected:Rows returns a list of selected rows.
 
Von: PeterWokke [mailto:bounce-PeterWokke@community.progress.com]
Gesendet: Montag, 6. Juli 2015 16:04
An: TU.OE.Development@community.progress.com
Betreff: [Technical Users - OE Development] How to process through the selected rows from an UltraGrid
 
Thread created by PeterWokke

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 

 

Stop receiving emails on this subject.

Flag this post as spam/abuse.

Posted by PeterWokke on 06-Jul-2015 09:36

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.

Posted by Richard.Kelters on 06-Jul-2015 10:55

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.

Posted by PeterWokke on 07-Jul-2015 01:11

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

Posted by Mike Fechner on 07-Jul-2015 02:13

Hi Richard, playing with .NET Enumerators:

github.com/.../foreach.i

{Consultingwerk/foreach.i UltraGridRow oRow in ultraGrid1:Selected:Rows}

    REPOSITION-TO-ROW(oRow:ListIndex + 1).

END.

Posted by Richard.Kelters on 07-Jul-2015 16:23

Thanks Mike!

A great contradication in the war .. I mean, debate against includes :)

This thread is closed