Dataset events not firing?

Posted by Jens Dahlin on 28-Aug-2012 05:59

I cannot get the CREATE-ROW (also tested, ROW-FILL, AFTER-ROW-FILL, AFTER-FILL etc) to fire.

Is there something wrong with my code? I'm loading the dataset from a url.

DEFINE VARIABLE giTransferId AS INTEGER NO-UNDO.

PROCEDURE rowCreate:

/*------------------------------------------------------------------------------
  Purpose:    
  Parameters:  <none>
  Notes:      
------------------------------------------------------------------------------*/
    DEFINE INPUT PARAMETER DATASET-HANDLE phDataSet.

    MESSAGE "rowCreate" VIEW-AS ALERT-BOX.

    giTransferId = giTransferId + 1.


END PROCEDURE.

DEFINE DATASET dsTransferRequest XML-NODE-NAME "xml"
    FOR TrSearchRq, Search_Criteria, Transfer, Rates, Inbound_Rate, Outbound_Rate, Both_Rate
    DATA-RELATION FOR Transfer, Rates      RELATION-FIELDS(id, id) NESTED FOREIGN-KEY-HIDDEN
    DATA-RELATION FOR Rates, Inbound_Rate  RELATION-FIELDS(id, id) NESTED FOREIGN-KEY-HIDDEN
    DATA-RELATION FOR Rates, Outbound_Rate RELATION-FIELDS(id, id) NESTED FOREIGN-KEY-HIDDEN
    DATA-RELATION FOR Rates, Both_Rate     RELATION-FIELDS(id, id) NESTED FOREIGN-KEY-HIDDEN.

/* This returns TRUE by the way...*/
DATASET dsTransferRequest:GET-BUFFER-HANDLE("Transfer"):SET-CALLBACK-PROCEDURE ("ROW-CREATE", "rowCreate").

lRead = DATASET dsTransferRequest:READ-XML( "FILE"
                                           , gcUrl + cQueryString
                                           , "MERGE"
                                           , ?
                                           , FALSE
                                           , ? ).

/* This FOR EACH displays several rows so data has been loaded */

FOR EACH Transfer:
    DISP Transfer.
END.

/* lRead is YES. giTransferID is 0 so no events! */

MESSAGE "READ:" lRead "~nTransfer Id: " giTransferId VIEW-AS ALERT-BOX .

All Replies

Posted by Peter Judge on 28-Aug-2012 08:02

There's a note in the help on READ-XML().

"Note: During the read operation, the AVM does not respond to ProDataSet events, and it does not track changes to the data in the ProDataSet or temp-table object (that is, it does not update the before-image tables) unless the XML document data is in the Microsoft DiffGram format.

"

It seems this is expected behaviour.

-- peter

This thread is closed