.Net pass in dataset into prodataset 4GL. input parameter dataset-handle can't get changes. - Forum - OpenEdge General - Progress Community

.Net pass in dataset into prodataset 4GL. input parameter dataset-handle can't get changes.

 Forum

.Net pass in dataset into prodataset 4GL. input parameter dataset-handle can't get changes.

  • hi all,

    I wanted to pass in some dataset from .net to Prodaset. but my 4GL always can't get the changedRow passed from .Net.

    Am i code anything wrong?

    ProgressObject.updateTestPage( datasetChanges, out pc_msg);   // from .Net contain one changed row and pass over...

    and my 4GL procedure as below:

    DEFINE VARIABLE h_temptable AS HANDLE      NO-UNDO.
    DEFINE VARIABLE h_physicaltable AS HANDLE      NO-UNDO.
    DEFINE VARIABLE pc_table AS CHARACTER   NO-UNDO.
    DEFINE VARIABLE h_datasource AS HANDLE      NO-UNDO.
    pc_table = "acp_bank".
    CREATE TEMP-TABLE h_temptable.
    CREATE BUFFER h_physicalTable FOR TABLE pc_table BUFFER-NAME pc_table.
    h_temptable:ADD-FIELDS-FROM(h_physicaltable).
    h_temptable:TEMP-TABLE-PREPARE("prodatasetTempTb").

    DEFINE INPUT parameter DATASET-HANDLE phdataset.

    phdataset:ADD-BUFFER(h_temptable:DEFAULT-BUFFER-HANDLE).
    h_temptable:TRACKING-CHANGES = TRUE.

    DEFINE OUTPUT PARAMETER pc_msg AS CHARACTER   NO-UNDO.
    CREATE DATASET phdataset.
    CREATE DATA-SOURCE h_datasource.
    h_datasource:ADD-SOURCE-BUFFER(h_physicaltable,"").

    RUN fillData.  


    PROCEDURE fillData: 
        DEFINE VARIABLE hTempBuffer AS HANDLE      NO-UNDO.
        DEFINE VARIABLE pd_tempPage AS DECIMAL     NO-UNDO.
        DEFINE VARIABLE pd_count AS DECIMAL     NO-UNDO.
        DEFINE VARIABLE h_query AS HANDLE      NO-UNDO.
        pd_tempPage = 1.
        CREATE QUERY h_query.
        h_query:SET-BUFFERS(h_temptable:DEFAULT-BUFFER-HANDLE:BEFORE-BUFFER).
        h_query:QUERY-PREPARE("for each biprodatasetTempTb").
        h_query:QUERY-OPEN().   <-------------------- it always return result 0
           IF ERROR-STATUS:ERROR THEN LEAVE.

        IF h_query:NUM-RESULTS = ? THEN LEAVE.
        REPEAT:
            IF ERROR-STATUS:ERROR THEN LEAVE.
            h_query:GET-NEXT().
           
            IF h_query:QUERY-OFF-END THEN DO:
               
                 LEAVE.

            END.

            // update here ......

        END.
    END PROCEDURE.

    Thanks

    Regards,

    TanMH

  • You don't have to create a new temp-table, nor a dataset.

    Just get the temp-table buffer handle from the received dataset using:

    phdataset:GET-BUFFER-HANDLE(1)

    You may specify the name of the temp-table instead of the 1.

    Make sure also you did call Progress.Open4GL.ProDataTable.SetBImageFlag() on each datatable on the .Net side.

  • Thx Guillaume,

    can you show me some coding sample for more detail?
    due to my temp-table are in dynamic form. there might
    be having more than one different schema strucutre temp-table involved.
    therefore, am i still need temp-table or something other thing? i though
    dataset need to pointing to one temp-table?

  • In .Net (C#):

    foreach (DataTable dt in )

       Progress.Open4GL.ProDataTable.SetBImageFlag(dt, true);

    In ABL:

    DEFINE INPUT parameter DATASET-HANDLE phdataset.

    DEFINE OUTPUT PARAMETER pc_msg AS CHARACTER   NO-UNDO.

    DEF VAR i AS INTE NO-UNDO.


    DO i = 1 TO phdataset:NUM-BUFFERS:

       RUN ReadBeforeBuffer(INPUT phdataset:GET-BUFFER-HANDLE(i)). 

    END.


    PROCEDURE ReadBeforeBuffer: 

        DEF INPUT PARAM ph_ttbuf AS HANDLE NO-UNDO.

       

        DEFINE VARIABLE h_query AS HANDLE      NO-UNDO.

        CREATE QUERY h_query.

       

        h_query:SET-BUFFERS(ph_ttbuf:BEFORE-BUFFER).

        h_query:QUERY-PREPARE(SUBST("for each &1", h_query:GET-BUFFER-HANDLE(1):NAME) ).

        IF h_query:QUERY-OPEN() THEN

        DO WHILE h_query:GET-NEXT():

           /* ... */

        END.

       

        FINALLY:

           DELETE OBJECT h_query.

        END.

    END PROCEDURE.

  • Thx Guillaume,

    i have tried in c#, yes it did have the SetBImageFlag(dt, true);
    and ur procedure coding is the very good example and very descriptive, thanks again...

    I have another question on progress.

    May I know how is the SetBImageFlag know which procedure to call?
    because like normal prodataset, i need to choose the .r file and
    use proxy generator to compile a DLL file and the dll file will know
    whichi procedure that need to call.

  • Sorry, I do not understand your question.


  • hi Guillaume,

    I mean, if I have a lot table in my progress. by just calling a SetBImageFlag(dt , true).
    it will know which table to update? or this will follow your dt 's schema match with progress
    table 's schema automatically and update arcordingly?

  • hi,

    the ph_ttbuf:BEFORE-BUFFER seems like is not valid handle. but ph_ttbuf is correct. just no before-table handle.

    seems like is last 's step to go only.

    Thank you.

    Regards,

    TanMH

  • hi ,

    is my bad, i left out to set the temp-table tracking-change = true when i read.

    But, i still can't get how is setBImageFlag work.

    Thank you.

    Regards,

    TAnMH

  • hi,

    due to some reason, i need to using manual paging and sorting due to huge data going to load in gridview.

    therefore, my Reading ABL can not use tracking-changes = true. due to some fill() and empty-dataset will be

    execute in the Reading process. therefore, I wontbe able to get the before-buffer in this case.

    is there any way to convert dataset-handle to dataset or assign all data from dataset-handle to dataset?

    Thank you.

    Regards,

    TAnMH