UltraGrid Datasource

Posted by simonhodgson on 11-Jan-2010 08:13

Hi I am just converting to OpenEdge 10.2B from 9.1E having been a developer since version 7.

Have found plenty of examples of UltraGrid where the whole table is displayed.

But only so far found limited examples of setting queries on the source tables to reduce the data returned etc.

Have followed the example in John Sadds video which works where just one source table, but brings the whole data set back where 2 or more tables are in the dataset.

Regards

Simon Hodgson.

All Replies

Posted by Admin on 24-Jul-2010 00:26

Simon:

Please take a look at the following method that returns dataset containing just the line itmes for a specific order number...

define temp-table and dataset such as ...

    DEFINE TEMP-TABLE ttOrderLine LIKE orderline.
    DEFINE DATASET dsOrderline FOR ttOrderline.

.......................................................................

    METHOD PUBLIC VOID GetOrderLines(INPUT orderNumber AS INTEGER ,  OUTPUT DATASET dsOrderLine  ):
       
        DEFINE QUERY qry FOR OrderLine.       
        DEFINE DATA-SOURCE src FOR QUERY qry.
       
        QUERY qry:QUERY-PREPARE ("FOR EACH orderLine WHERE orderNum EQ " + STRING(orderNumber) + " NO-LOCK ").
               
        BUFFER ttOrderLine:ATTACH-DATA-SOURCE (DATA-SOURCE src:HANDLE).
        ASSIGN BUFFER ttOrderLine:FILL-MODE  = "EMPTY" .   
        DATASET dsOrderLine:FILL().
           
       
        RETURN.
        CATCH e AS Progress.Lang.Error:
            MESSAGE "Exception in DAL : GetOrderLines " e:GetMessage(1) VIEW-AS ALERT-BOX.             
        END CATCH.

        FINALLY:
            BUFFER ttOrderLine:DETACH-DATA-SOURCE () NO-ERROR .
        END FINALLY.
       
    END METHOD.

This thread is closed