Chris Knickerbocker
New Member
I was testing the following code to update the results list for a browse/query when a FK value in the query join is changed in the browse. It appears to work initially but upon adding a row etc. to the browse, blank rows appear in the browse and data disappears. Any idea why this wouldn't work? It would offer some advantages over using browse variables and a find trigger.
/* query definition */
OPEN QUERY {&SELF-NAME}
FOR EACH hrtim where hrtim.emp-num = in-emp-num NO-LOCK,
first prtab21 where prtab21.tbl-21 = 21
and prtab21.ts-typ = hrtim.ts-typ no-lock.
...
(upon user update and row-leave of browse)
/* delete and re-insert row to get latest prtab21 description into results list */
hrtim-rowid = rowid(hrtim).
prtab21-rowid = rowid(prtab21).
Stat = {&browse-name}:delete-current-row().
Stat = browse-6:insert-row("before").
find hrtim where rowid(hrtim) = hrtim-rowid.
find prtab21 where rowid(prtab21) = prtab21-rowid.
assign
hrtim.beg-dte:screen-value = string(hrtim.beg-dte)
hrtim.ts-typ:screen-value = hrtim.ts-typ
prtab21.ts-des:screen-value = prtab21.ts-des
hrtim.dly-rte:screen-value = string(hrtim.dly-rte)
hrtim.sid-acct:screen-value = hrtim.sid-acct
hrtim.pay-dte:screen-value = string(hrtim.pay-dte).
Stat = {&BROWSE-NAME}:CREATE-RESULT-LIST-ENTRY().
release hrtim.
/* query definition */
OPEN QUERY {&SELF-NAME}
FOR EACH hrtim where hrtim.emp-num = in-emp-num NO-LOCK,
first prtab21 where prtab21.tbl-21 = 21
and prtab21.ts-typ = hrtim.ts-typ no-lock.
...
(upon user update and row-leave of browse)
/* delete and re-insert row to get latest prtab21 description into results list */
hrtim-rowid = rowid(hrtim).
prtab21-rowid = rowid(prtab21).
Stat = {&browse-name}:delete-current-row().
Stat = browse-6:insert-row("before").
find hrtim where rowid(hrtim) = hrtim-rowid.
find prtab21 where rowid(prtab21) = prtab21-rowid.
assign
hrtim.beg-dte:screen-value = string(hrtim.beg-dte)
hrtim.ts-typ:screen-value = hrtim.ts-typ
prtab21.ts-des:screen-value = prtab21.ts-des
hrtim.dly-rte:screen-value = string(hrtim.dly-rte)
hrtim.sid-acct:screen-value = hrtim.sid-acct
hrtim.pay-dte:screen-value = string(hrtim.pay-dte).
Stat = {&BROWSE-NAME}:CREATE-RESULT-LIST-ENTRY().
release hrtim.