Problem with Dataset and save-row-changes

Posted by annord on 19-Apr-2011 08:39

The method "save-row-changes" return the message :

Unable to identify data-source buffer for SAVE-ROW-CHANGES. (11906)

What's wrong in my code ?

here is an extract of source code on server:

DEFINE TEMP-TABLE tt_param_local
    BEFORE-TABLE bi_tt_param_local
    FIELD code_expl                        AS CHARACTER    FORMAT "X(3)":U               /*  */
    FIELD type_param                       AS CHARACTER    FORMAT "X(3)":U               /*  */
    FIELD categ_param                      AS CHARACTER    FORMAT "X(3)":U               /*  */
    FIELD code_param                       AS CHARACTER    FORMAT "X(8)":U               /*  */
    FIELD lib_param                        AS CHARACTER    FORMAT "X(35)":U              /*  */
    FIELD zone_logi1                       AS INTEGER      FORMAT "-9":U                 /*  */
    FIELD date_creat                       AS DATE         FORMAT "99/99/99":U           /*  */
    FIELD heure_creat                      AS INTEGER      FORMAT "->>>>9":U             /*  */
    FIELD oper_creat                       AS CHARACTER    FORMAT "X(10)":U              /*  */
    FIELD date_modif                       AS DATE         FORMAT "99/99/99":U           /*  */
    FIELD heure_modif                      AS INTEGER      FORMAT "->>>>9":U             /*  */
    FIELD oper_modif                       AS CHARACTER    FORMAT "X(10)":U              /*  */
    FIELD ROWID_db                         AS ROWID
    FIELD numEnr                           AS INTEGER 
    INDEX PK_PARAMETRE_LOCAL               IS PRIMARY UNIQUE       CODE_EXPL TYPE_PARAM CATEG_PARAM CODE_PARAM
    .
   
DEFINE DATASET  ds_param_local
    FOR tt_param_local
    .
DEFINE DATA-SOURCE srcParam FOR parametre_local /* table name in database */
        keys(CODE_EXPL,TYPE_PARAM,CATEG_PARAM,CODE_PARAM).
      
PROCEDURE SetParam:
    DEFINE INPUT-OUTPUT PARAMETER DATASET FOR ds_param_local.
    DEFINE VARIABLE lResult AS LOGICAL NO-UNDO.
   
    BUFFER tt_param_local:ATTACH-DATA-SOURCE(DATA-SOURCE srcParam:HANDLE).
    FOR EACH bi_tt_param_local NO-LOCK:
        lResult = BUFFER bi_tt_param_local:SAVE-ROW-CHANGES("tt_param_local",
                                                            "date_creat,heure_creat,oper_creat,date_modif,heure_modif,oper_modif,ROWID_db,numEnr"). /* exceptions */
    END.
    BUFFER tt_param_local:DETACH-DATA-SOURCE ().
   
    RETURN.
   
END PROCEDURE. /* SetParam */  

All Replies

Posted by Admin on 19-Apr-2011 09:07

        lResult = BUFFER bi_tt_param_local:SAVE-ROW-CHANGES("tt_param_local",
                                                            "date_creat,heure_creat,oper_creat,date_modif,heure_modif,oper_modif,ROWID_db,numEnr"). /* exceptions */

The SAVE-ROW-CHANGES method expects the data source buffer name - that is the name of the datbase buffer, parametre_local in your case. Not any of the temp-table buffer names (before and after).

How the heck, did you achieve this nice ABL formatting including syntax cooring????

Posted by annord on 19-Apr-2011 09:33

Thanks Mike.

It"s ok for my test. I changed for :

lResult = BUFFER parametre_local:BEFORE-TABLE:SAVE-ROW-CHANGES("",

"date_creat,heure_creat,oper_creat,date_modif,heure_modif,oper_modif,ROWID_db,numEnr") /* exceptions */

The trick to preserve formatting code is:
Copy it into "word", apply the font "Courier New" and paste the formatted text in the post

Posted by annord on 20-Apr-2011 03:45

In fact, I went a little fast in my test yesterday, the solution does'nt work.

1) First test : KO

            lhSR  = BUFFER PARAMETRE_LOCAL:HANDLE.

            lResult = lhSr:SAVE-ROW-CHANGES("tt_param_local").

Message : SAVE-ROW-CHANGES must be run on the BEFORE table of buffer PARAMETRE_LOCAL. (11938)

2) Second test : KO

           lhSR  = BUFFER PARAMETRE_LOCAL:BEFORE-BUFFER. (or BEFORE-TABLE)

           lResult = lhSr:SAVE-ROW-CHANGES("tt_param_local").

Message : Invalid handle. Not initialized or points to a deleted object. (3135)
          Cannot access the SAVE-ROW-CHANGES attribute because the widget does not exist. (3140)

3) Third test : OK

With "Before buffer" to temp-table and without parameters on SAVE-ROW-CHANGES

            lhBi = BUFFER bi_tt_param_local:handle.
            lResult = lhBi:SAVE-ROW-CHANGES.

I still have to dig why interfere with parameters on SAVE-ROW-CHANGES ?...

Posted by Admin on 20-Apr-2011 11:30

First test :

lhSR = BUFFER PARAMETRE_LOCAL:HANDLE.

Second test :

lhSR = BUFFER PARAMETRE_LOCAL:BEFORE-BUFFER.

When I'm understanding your code correctly, PARAMETRE_LOCAL is your DB table. You can't run the method on a DB buffer.

You have to run it on a reference to the temp-table before buffer (sorry for confusing you with the temp-table after buffer).

The name of the DB buffer is the optional argument to the SAVE-ROW-CHANGES method. But when there is just one data-source buffer (no joined query as the data-source) there is no need to use any parameter at all.

This thread is closed