Getting the correct buffer handle in InitializeRow event of

Posted by gdb390 on 27-Jan-2015 09:24

Hello,

I have a form with an ultragrid and a bindingsource.  I want to show the customers from the sports db.

I attach the dataset handle with data to the bindingsource handle and alla data is shown. So far , no problem.

I now want to add an unbound column with the number of orders for each customer. (and no, I don't want to add it to my temp-table definition !)

In the initializelayout event of the grid I add a column, set the datatype  , code is below : 

    define variable layout as Infragistics.Win.UltraWinGrid.UltraGridLayout no-undo.
    define variable band   as Infragistics.Win.UltraWinGrid.UltraGridBand   no-undo.
		
    layout = e:Layout.
    band = layout:Bands[0].
    
    define variable calcCol as Infragistics.Win.UltraWinGrid.UltraGridColumn no-undo.
    
    calcCol = band:Columns:Add("KeyCalcCol":u, "Number orders":u).
    calcCol:DataType = Progress.Util.TypeHelper:GetType("System.Int32").

The column is shown : OK

I now want to fill the column with data, so I go to the InitializeRow event of the grid.

There it goes wrong : I always get the value of the first record even though the row is a different row.

This code is correct : e:Row:Cells:Item["Cust-Num"]:Value  -> it gives me the correct customer number 

If I test : available(ttCustomer) -> OK, but it always gives me the first customer whatever row I'm on 

The AutoSync attribute on the datasource is true.

Anyone an idea ?

Posted by Mike Fechner on 27-Jan-2015 09:38

When a grid is populated, the BindingSource does (probably for performance reasons) not reposition the Query or fetch a record in the buffer.
 
You should reconsider your resistance from counting the order lines on the backend J
 
All you have in access is the UltraGridRow instance. You could also get the CustNum from
 
UNBOX (e:Row:Cells[“CustNum”]:Value)
 
and run a query yourself.
 
Von: gdb390 [mailto:bounce-gdb390@community.progress.com]
Gesendet: Dienstag, 27. Januar 2015 16:25
An: TU.OE.Development@community.progress.com
Betreff: [Technical Users - OE Development] Getting the correct buffer handle in InitializeRow event of Ultragrid
 
Thread created by gdb390

Hello,

I have a form with an ultragrid and a bindingsource.  I want to show the customers from the sports db.

I attach the dataset handle with data to the bindingsource handle and alla data is shown. So far , no problem.

I now want to add an unbound column with the number of orders for each customer. (and no, I don't want to add it to my temp-table definition !)

In the initializelayout event of the grid I add a column, set the datatype  , code is below : 

    define variable layout as Infragistics.Win.UltraWinGrid.UltraGridLayout no-undo.
    define variable band   as Infragistics.Win.UltraWinGrid.UltraGridBand   no-undo.
               
    layout = e:Layout.
    band = layout:Bands[0].
    
    define variable calcCol as Infragistics.Win.UltraWinGrid.UltraGridColumn no-undo.
    
    calcCol = band:Columns:Add("KeyCalcCol":u, "Number orders":u).
    calcCol:DataType = Progress.Util.TypeHelper:GetType("System.Int32").

The column is shown : OK

I now want to fill the column with data, so I go to the InitializeRow event of the grid.

There it goes wrong : I always get the value of the first record even though the row is a different row.

This code is correct : e:Row:Cells:Item["Cust-Num"]:Value  -> it gives me the correct customer number 

If I test : available(ttCustomer) -> OK, but it always gives me the first customer whatever row I'm on 

The AutoSync attribute on the datasource is true.

Anyone an idea ?

Stop receiving emails on this subject.

Flag this post as spam/abuse.

Posted by Mike Fechner on 27-Jan-2015 10:07

“I want to accomplish an automatic conversion from a progress browser to an infragistics grid.”

There is a tool available that does this out of the box, including calculated fields, color coding, etc… J If I would only remember the name.
 

All Replies

Posted by Mike Fechner on 27-Jan-2015 09:38

When a grid is populated, the BindingSource does (probably for performance reasons) not reposition the Query or fetch a record in the buffer.
 
You should reconsider your resistance from counting the order lines on the backend J
 
All you have in access is the UltraGridRow instance. You could also get the CustNum from
 
UNBOX (e:Row:Cells[“CustNum”]:Value)
 
and run a query yourself.
Von: gdb390 [mailto:bounce-gdb390@community.progress.com]
Gesendet: Dienstag, 27. Januar 2015 16:25
An: TU.OE.Development@community.progress.com
Betreff: [Technical Users - OE Development] Getting the correct buffer handle in InitializeRow event of Ultragrid
 
Thread created by gdb390

Hello,

I have a form with an ultragrid and a bindingsource.  I want to show the customers from the sports db.

I attach the dataset handle with data to the bindingsource handle and alla data is shown. So far , no problem.

I now want to add an unbound column with the number of orders for each customer. (and no, I don't want to add it to my temp-table definition !)

In the initializelayout event of the grid I add a column, set the datatype  , code is below : 

    define variable layout as Infragistics.Win.UltraWinGrid.UltraGridLayout no-undo.
    define variable band   as Infragistics.Win.UltraWinGrid.UltraGridBand   no-undo.
               
    layout = e:Layout.
    band = layout:Bands[0].
    
    define variable calcCol as Infragistics.Win.UltraWinGrid.UltraGridColumn no-undo.
    
    calcCol = band:Columns:Add("KeyCalcCol":u, "Number orders":u).
    calcCol:DataType = Progress.Util.TypeHelper:GetType("System.Int32").

The column is shown : OK

I now want to fill the column with data, so I go to the InitializeRow event of the grid.

There it goes wrong : I always get the value of the first record even though the row is a different row.

This code is correct : e:Row:Cells:Item["Cust-Num"]:Value  -> it gives me the correct customer number 

If I test : available(ttCustomer) -> OK, but it always gives me the first customer whatever row I'm on 

The AutoSync attribute on the datasource is true.

Anyone an idea ?

Stop receiving emails on this subject.

Flag this post as spam/abuse.

Posted by gdb390 on 27-Jan-2015 10:04

Mike,

Thanks for the answer, although it is not want I wanted to hear.

I want to accomplish an automatic conversion from a progress browser to an infragistics grid.

I detach the query from the browser and attach it to the bindingsource, but then I only get the fields in the buffer and not the calculated fields that were in the browser.

So I thought, I add the columns as unbound columns, and populate them in the initializeRow , but no good going that way ...

I find it very strange that the fields in the buffer are appropiate and that the bindingsource is not following

kind regards

gerd

Posted by Mike Fechner on 27-Jan-2015 10:07

“I want to accomplish an automatic conversion from a progress browser to an infragistics grid.”

There is a tool available that does this out of the box, including calculated fields, color coding, etc… J If I would only remember the name.
 

Posted by James Palmer on 27-Jan-2015 10:10

I remember the one you mean Mike. It's something like LinBox isn't it? :)

Posted by Mike Fechner on 27-Jan-2015 10:13

Two letters seem to be right. J

Posted by gdb390 on 27-Jan-2015 10:16

Yeah yeah ... I get the picture ... I'm alone on this one ...

Posted by Mike Fechner on 27-Jan-2015 10:18

No – it was a lot of fun implementing it! You’ll enjoy it J

This thread is closed