prodataset MARK-ROW-STATE

Posted by LegacyUser on 18-Nov-2008 05:20

Hi All,

Pl provide an example for using MARK-ROW-STATE method.

thanks.

All Replies

Posted by Admin on 26-Nov-2008 10:45

The fact that nobody replied so far may show two things:

1st: it's hard to answer such an unspecific questions

2nd: I doubt there are simple samples for this method.

The method simulates a tracked change in a prodataset temp-table. So when the change has been made without tracking changes = YES. Or when you want to simulate a change in an empty dataset. For tracking changes, you need records in the prodataset temp-tables that can actually be modified. If you want to use a prodataset (or a business entity) to import modified data for example from a flat file, it's not very usefull to have to fetch the original rows from the database first. You can use MARK-ROW-STATE to simulate the change, create the before-image-record so the you can use the attached data-sources to write the changes to the db.

What are you trying to use it for? What's your issue?

Posted by ericg on 12-Feb-2009 15:59

I was also wondering how to use MARK-ROW-STATE(). This method takes a row-state arguement, but how can one know the row-state on records if dealing with a after table? Thanks for any help!

Posted by Håvard Danielsen on 13-Feb-2009 12:06

I'm not sure I understand the question, but you basically use mark-row-state when you don't have before and after-image records. You would typically need to get the information of the type of update together with the data somehow in order to use mark-row-state.

Posted by oomsluc on 06-Dec-2009 07:48

What do you mean with PL . Where can we  find this ?

Posted by hoomank on 18-May-2010 14:25

This is a crude example, hope it helps

DEFINE VARIABLE bh1 AS HANDLE.

DEFINE TEMP-TABLE ttAcctMast BEFORE-TABLE btAcctmast

  FIELD cnbr AS INTEGER

  FIELD acct AS DECIMAL.

DEFINE TEMP-TABLE ttNotes BEFORE-TABLE btNotes

  FIELD cnbr AS INTEGER

  FIELD acct AS DECIMAL.

DEFINE DATASET dstest FOR ttAcctmast, ttNotes

  DATA-RELATION drAcctProm FOR ttAcctMast, ttNotes

  RELATION-FIELDS(cnbr, cnbr, acct, acct).

FIND FIRST acctmast.

CREATE ttAcctmast.

BUFFER-COPY acctmast TO ttacctmast.

FOR EACH notes WHERE notes.cnbr = acctmast.cnbr AND notes.acct = acctmast.acct:

  CREATE ttNotes.

  BUFFER-COPY notes TO ttnotes.

END.

bh1 = DATASET dsTest:GET-BUFFER-HANDLE('ttNotes').

FIND FIRST ttnotes.

bh1:mark-row-state(2, bh1).

FIND FIRST ttNotes WHERE

  ROW-STATE(ttNotes) = ROW-MODIFIED

  NO-LOCK NO-ERROR.

MESSAGE AVAILABLE ttnotes VIEW-AS ALERT-BOX.

FIND FIRST btNotes.

MESSAGE AVAILABLE btNotes VIEW-AS ALERT-BOX.

Posted by danielStafford on 18-May-2010 15:35

When a user chooses the "New" button to create a new contact, I fetch a template set of records from the db and mark them new (after changing the key fields).

METHOD PUBLIC CHARACTER markRowState(contactIdToBeMarked AS CHARACTER, markState AS INTEGER):

        DEFINE VARIABLE hQuery         AS HANDLE    NO-UNDO.

        DEFINE VARIABLE hBuffer        AS HANDLE    NO-UNDO.

        DEFINE VARIABLE iBuffer        AS INTEGER   NO-UNDO.

        DEFINE VARIABLE newUUID        AS CHARACTER NO-UNDO.

        DEFINE VARIABLE newContactUUID AS CHARACTER NO-UNDO.

        DO iBuffer = 1 TO hContactDS:NUM-BUFFERS:

            CREATE QUERY hQuery.

            hBuffer = hContactDS:GET-BUFFER-HANDLE(iBuffer).

            hQuery:ADD-BUFFER(hBuffer).

            hQuery:QUERY-PREPARE("FOR EACH " + hBuffer:NAME + " where " + hBuffer:NAME + ".contactID = " + quoter(contactIdToBeMarked)).

            hQuery:QUERY-OPEN().

            hQuery:GET-FIRST().

            DO WHILE NOT hQuery:QUERY-OFF-END:

                hBuffer:mark-row-state(markState).

                hQuery:GET-NEXT().

            END.

            hQuery:QUERY-CLOSE().

            DELETE OBJECT hQuery.

        END.

        CATCH e AS Progress.Lang.SysError :

            UNDO, THROW e.

        END CATCH.

    END METHOD.

Posted by rbf on 19-May-2010 01:48

oomsluc wrote:

What do you mean with PL . Where can we  find this ?

I think that means Please

This thread is closed