Connecting Progress QUERY to UltraGrid

Posted by Ken Ward on 15-Sep-2016 16:05

So, I'm trying to use the documentation here.

I'm getting an error when I try to do this.

CLASS lbld64 INHERITS Form:

    .
    .
    .

  DEFINE PRIVATE VARIABLE ultraGrid1 AS Infragistics.Win.UltraWinGrid.UltraGrid NO-UNDO.
  DEFINE PRIVATE VARIABLE srcProps   AS Progress.Data.BindingSource             NO-UNDO.
    
  DEFINE PRIVATE TEMP-TABLE ttProps NO-UNDO
    FIELD pName  AS CHARACTER
    FIELD pValueType AS CHARACTER
    FIELD pValue AS Progress.Lang.Object
   .

  DEFINE PRIVATE QUERY qProps FOR ttProps.

        
  CONSTRUCTOR PUBLIC lbld64 (  ):
          
    SUPER().
          
    InitializeComponent().
 
    srcProps = NEW Progress.Data.BindingSource(qProps).   
             
    ultraGrid1:DataSource = srcProps.
        
    THIS-OBJECT:ComponentsCollection:ADD(THIS-OBJECT:components).
    CATCH e AS Progress.Lang.Error:
      UNDO, THROW e.
    END CATCH.
 
  END CONSTRUCTOR.

    .
    .
    .

END CLASS.


I'm getting an error on this line: "srcProps = NEW Progress.Data.BindingSource(qProps)."

** Unknown Field or Variable name - qProps. (201)

It looks like I'm doing everything in the documentation.


What am I missing?

All Replies

Posted by Mike Fechner on 15-Sep-2016 16:10

QUERY qProps:HANDLE.

And define the QUERY with the SCROLLING option.


Posted by Ken Ward on 15-Sep-2016 16:19

If I may, what is the effect and/or benefit of the SCROLLING Option?

Posted by Ken Ward on 15-Sep-2016 16:22

I made the changes requested and I'm still getting the same error.

DEFINE PRIVATE QUERY qProps FOR ttProps SCROLLING.

CONSTRUCTOR PUBLIC lbld64 (  ):

          SUPER().

          InitializeComponent().

          srcProps = NEW Progress.Data.BindingSource(qProps:HANDLE).  

          ultraGrid1:DataSource = srcProps.

          THIS-OBJECT:ComponentsCollection:ADD(THIS-OBJECT:components).

          CATCH e AS Progress.Lang.Error:

              UNDO, THROW e.

          END CATCH.

END CONSTRUCTOR.

** Unknown Field or Variable name - qProps. (201)

Posted by Laura Stern on 15-Sep-2016 19:26

I believe you have to say "QUERY qprops:HANDLE".

Posted by Mike Fechner on 15-Sep-2016 23:08

SCROLLING adds a result list to the query. That allows the query to be used in forward and backwards direction. It's just a requirement for Grid controls etc..


Posted by Stefan Marquardt on 16-Sep-2016 02:25

As Laura mentioned:

srcProps = NEW Progress.Data.BindingSource(query qProps:HANDLE).  

should solve the compile error, SCROLLING is a good hint by Mike. (hidden in the doc)

DEFINE PRIVATE QUERY qProps FOR ttProps SCROLLING.

But I think there is missing OPEN QUERY, if it compiles, you should get a runtime error.

I run my own first tests and used dynamic queries and datasets but not static ones.

Used you example, fixed your source error, added open query to a populated temp-table and I get now the column headers without any records in the Grid.

Can you add a correct doc link, the one you added is not working. I can't find any example in the docs with static query, binding-source and a grid control, perhaps you did it.

I "love" Progress docs, they give you only piece of the cookies but very rare a working example, only for .NET:

DataTable custTable = custOrderDataSet.Tables[Customer];

bindingSource = new BindingSource();

bindingSource.DataSource = custTable;

customerGrid = new DataGrid();

customerGrid.DataSource = bindingSource;

I can't find a ABL.NET example to use a temp-table as DataTable.

Posted by Ken Ward on 16-Sep-2016 08:31

Oops! I missed the QUERY keyword in there.

"But I think there is missing OPEN QUERY, if it compiles, you should get a runtime error."

My intention was to set up the relationship, then use CLOSE QUERY / OPEN QUERY at the appropriate time to populate the grid. I don't know at the time of construction what will be in this temp table and it will be empty initially.

"DataTable custTable = custOrderDataSet.Tables[Customer];"

I'm unfamiliar with the DataTable Object.

I should probably confess that most of my experience with Progress is with v9.1e ABL code.

I'm familiar with OOP and .Net concepts, I'm just having a problem marrying the two.

"I can't find a ABL.NET example to use a temp-table as DataTable."

I'm just taking it on blind faith that this will be OK.

Thanks everyone for your help!

-Ken

Posted by Laura Stern on 19-Sep-2016 08:29

Why are you now talking about using a DataTable object?  You don't need one when you use the Progress.Data.BindingSource.  The alternative to using the ProBindingSource is to transfer all the data from the temp-table into a .NET DataTable and then bind the grid to that.  But if there is a lot of data, that is not recommended.

Is there still a question here?  I can't tell if you are all set or not.

Posted by Stefan Marquardt on 19-Sep-2016 11:15

Laura,

not I am talking, that's in your docs when you try to search a working static buffer binding example.

Newbie ABL is user is searching for an working example and the only thing what's in the doc is an C# example but not the same with a temp-table.

Posted by Laura Stern on 20-Sep-2016 11:54

Yes, we should have a sample.  We'll look into that.

Posted by Stefan Marquardt on 27-Sep-2016 01:41

Now there is one as KB: 000074137

This thread is closed