Answered Creating Pds With No Relationships

I haven't really used PDS very much and feel really stupid asking this question but pride aside here it goes. I'm trying to create a dataset with only one tabled defined as a database table (cds-prod) and the rest of the temp tables (about 10 in total) would be used just as transports in the calling procedures. Long story short I'm trying to consolidate shared temp-tables that have no relationship in old code and pass them via a single dataset. I've tried many different approaches but below is the closest I've come. I get back an error "FILL requires an attached data-source for buffer EngineInputTable, or an active before-fill callback procedure. (11874)", however it does fill the top level ttcds-parms table.

You'll also see the field scRequestID in the code. I played around with the idea that this would be passed as a request to become a token linking all the temp tables. I'm sure this is just my lack of experience and any push in the right direction would be greatly appreciated.

Code:
/* DataSet ProtoTyping */

DEFINE TEMP-TABLE ttcds-parms LIKE cds-parms BEFORE-TABLE biParms
   FIELD scRequestID         AS CHAR
   FIELD dbRowiD             AS ROWID
   INDEX iRequestID IS PRIMARY  scRequestID.

DEFINE TEMP-TABLE EngineInputTable BEFORE-TABLE biEngineInputTable
    FIELD scRequestID         AS CHAR
    FIELD func-code           AS INT
    FIELD dbRowid             AS ROWID
    INDEX iRequestID IS PRIMARY scRequestID.



DEFINE DATASET dsSC FOR ttcds-parms,EngineInputTable
              DATA-RELATION drParms FOR ttcds-parms, EngineInputTable RELATION-FIELDS (DBROWID,scRequestID).


DEF VAR srcEngine AS HANDLE.
DEF VAR hdsSC     AS HANDLE NO-UNDO.
DEF VAR cWhereClause AS CHAR   NO-UNDO.


cWhereClause = SUBSTITUTE("FOR EACH cds-parms WHERE cds-parms.store-nbr = &1
                              AND cds-parms.color-comp   = &2
                              NO-LOCK",1002,QUOTER("Company1")).

DEFINE QUERY qParms FOR cds-parms.

DEFINE DATA-SOURCE srcParms  FOR QUERY qParms cds-parms KEYS (ROWID,scRequestID).

CREATE DATA-SOURCE srcEngine.
srcEngine:ADD-SOURCE-BUFFER(BUFFER EngineInputTable:HANDLE,"scRequestID").
BUFFER   ttcds-parms:ATTACH-DATA-SOURCE
               (DATA-SOURCE srcParms:HANDLE,"dbRowID,ROWID(cds-parms)").

QUERY qParms:QUERY-PREPARE(cWhereClause).
hdsSC = DATASET dsSC:HANDLE.

hdsSC:GET-BUFFER-HANDLE("ttcds-parms"):SET-CALLBACK-PROCEDURE
          ("AFTER-ROW-FILL", "setSessionid", THIS-PROCEDURE).

DATASET dsSC:FILL().

BUFFER ttcds-parms:DETACH-DATA-SOURCE().

for each ttcds-parms:
display ttcds-parms except dbrowid.
ENd.

PROCEDURE setSessionId:
   DEFINE INPUT PARAM dataset FOR dsSC.
     ttcds-parms.scRequestID = "1234".
END PROCEDURE.
 
Top