.Net pass in dataset into prodataset 4GL. input parameter da

Posted by mhtan88 on 10-Nov-2009 08:29

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

All Replies

Posted by guilmori on 10-Nov-2009 09:14

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.

Posted by mhtan88 on 10-Nov-2009 09:45

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?

Posted by guilmori on 10-Nov-2009 10:01

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.

Posted by mhtan88 on 10-Nov-2009 11:22

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.

Posted by guilmori on 10-Nov-2009 12:00

Sorry, I do not understand your question.

Posted by mhtan88 on 10-Nov-2009 17:29


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?

Posted by mhtan88 on 10-Nov-2009 18:49

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

Posted by mhtan88 on 10-Nov-2009 19:03

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

Posted by mhtan88 on 10-Nov-2009 21:31

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

This thread is closed