Hi,
I created a dynamic browse, with as data-source a temp-table but i don't know how to write the changes made to fields in this updatable browser to the temp-table.
code in the main-block:
CREATE BUFFER table-name FOR TABLE "tt_productie".
CREATE QUERY dyn-query.
/* set the query and create the browse */
dyn-query:SET-BUFFERS(table-name).
CREATE BROWSE dyn-browse
ASSIGN WIDTH = 64
HEIGHT = 12
EXPANDABLE = FALSE
COLUMN = 1
ROW = 1
FRAME = FRAME frm_prod:HANDLE
READ-ONLY = FALSE
SENSITIVE = TRUE
SEPARATORS = TRUE
ROW-MARKERS = TRUE
VISIBLE = TRUE
COLUMN-RESIZABLE = TRUE
TRIGGERS:
ON ROW-LEAVE
PERSISTENT RUN test.
END.
/* attach the query to the browser */
dyn-browse:QUERY = dyn-query.
/* query value is the string which will be used to open the query */
query-value = "For each tt_productie"
/*where dwpdc_mstr.dwpdc_date >= 19/03/2007"*/.
/* prepare and open the query */
dyn-query:QUERY-PREPARE(query-value).
ASSIGN v_list = "tt_productie.afdeling,tt_productie.machine,tt_productie.tiknr,tt_productie.action,tt_productie.prodtijd,tt_productie.prodstil,tt_productie.totaal".
DO cntr = 1 TO NUM-ENTRIES(v_list, ","):
col-handle = dyn-browse:ADD-LIKE-COLUMN(ENTRY(cntr,v_list, ",")).
col-handle:READ-ONLY = NO.
END.
/* col-handle2 = dyn-browse:ADD-CALC-COLUMN("char","99","","prod time",5). */
/* col-handle3 = dyn-browse:ADD-CALC-COLUMN("char","99","","Totaal",7). */
dyn-query:QUERY-OPEN().
APPLY "home" TO dyn-browse.
This works fine. My browse is showed with the data i need.
But when i edit some data in the browse i want to save this data in the temp-table off course.. and i am not sure how to do this.
in procedure test (used in the on-row-leave trigger in the code above)
i have the following code:
IF dyn-browse:CURRENT-ROW-MODIFIED THEN DO:
REPEAT v_i = 1 TO dyn-browse:NUM-COLUMNS:
col-handle = dyn-browse:GET-BROWSE-COLUMN(v_i).
IF col-handle:MODIFIED
THEN DO:
fld-handle = col-handle:BUFFER-FIELD.
/* if buff-field-hdl is unknown, this is a calculated field
and cannot be updated */
IF fld-handle NE ?
THEN fld-handle:BUFFER-VALUE = col-handle:SCREEN-VALUE.
MESSAGE fld-handle:BUFFER-VALUE SKIP
col-handle:BUFFER-FIELD:NAME.
END. /*col-handle:MODIFIED*/
END. /*REPEAT j = 1 TO dyn-browse:NUM-COLUMNS*/
END. /*dyn-browse:CURRENT-ROW-MODIFIED*/
This way i can see what field is changed en to which value. But i have no rowid or something .. so how can i add these changes to the temp-table?
Thanks a lot!
best regards,
Elise
I created a dynamic browse, with as data-source a temp-table but i don't know how to write the changes made to fields in this updatable browser to the temp-table.
code in the main-block:
CREATE BUFFER table-name FOR TABLE "tt_productie".
CREATE QUERY dyn-query.
/* set the query and create the browse */
dyn-query:SET-BUFFERS(table-name).
CREATE BROWSE dyn-browse
ASSIGN WIDTH = 64
HEIGHT = 12
EXPANDABLE = FALSE
COLUMN = 1
ROW = 1
FRAME = FRAME frm_prod:HANDLE
READ-ONLY = FALSE
SENSITIVE = TRUE
SEPARATORS = TRUE
ROW-MARKERS = TRUE
VISIBLE = TRUE
COLUMN-RESIZABLE = TRUE
TRIGGERS:
ON ROW-LEAVE
PERSISTENT RUN test.
END.
/* attach the query to the browser */
dyn-browse:QUERY = dyn-query.
/* query value is the string which will be used to open the query */
query-value = "For each tt_productie"
/*where dwpdc_mstr.dwpdc_date >= 19/03/2007"*/.
/* prepare and open the query */
dyn-query:QUERY-PREPARE(query-value).
ASSIGN v_list = "tt_productie.afdeling,tt_productie.machine,tt_productie.tiknr,tt_productie.action,tt_productie.prodtijd,tt_productie.prodstil,tt_productie.totaal".
DO cntr = 1 TO NUM-ENTRIES(v_list, ","):
col-handle = dyn-browse:ADD-LIKE-COLUMN(ENTRY(cntr,v_list, ",")).
col-handle:READ-ONLY = NO.
END.
/* col-handle2 = dyn-browse:ADD-CALC-COLUMN("char","99","","prod time",5). */
/* col-handle3 = dyn-browse:ADD-CALC-COLUMN("char","99","","Totaal",7). */
dyn-query:QUERY-OPEN().
APPLY "home" TO dyn-browse.
This works fine. My browse is showed with the data i need.
But when i edit some data in the browse i want to save this data in the temp-table off course.. and i am not sure how to do this.
in procedure test (used in the on-row-leave trigger in the code above)
i have the following code:
IF dyn-browse:CURRENT-ROW-MODIFIED THEN DO:
REPEAT v_i = 1 TO dyn-browse:NUM-COLUMNS:
col-handle = dyn-browse:GET-BROWSE-COLUMN(v_i).
IF col-handle:MODIFIED
THEN DO:
fld-handle = col-handle:BUFFER-FIELD.
/* if buff-field-hdl is unknown, this is a calculated field
and cannot be updated */
IF fld-handle NE ?
THEN fld-handle:BUFFER-VALUE = col-handle:SCREEN-VALUE.
MESSAGE fld-handle:BUFFER-VALUE SKIP
col-handle:BUFFER-FIELD:NAME.
END. /*col-handle:MODIFIED*/
END. /*REPEAT j = 1 TO dyn-browse:NUM-COLUMNS*/
END. /*dyn-browse:CURRENT-ROW-MODIFIED*/
This way i can see what field is changed en to which value. But i have no rowid or something .. so how can i add these changes to the temp-table?
Thanks a lot!
best regards,
Elise