Parameters
Internal usage
QadFinancials
program code (program1/treportswitchmenu.p)
assign vcField1 = "mnd_uri"
vcField2 = "resourceURI".
/* mnd_det */
define variable vhMnd_det as handle no-undo.
define variable qhMnd_det as handle no-undo.
create query qhMnd_det in widget-pool "non-persistent".
create buffer vhMnd_det for table "mnd_det" in widget-pool "non-persistent".
qhMnd_det:set-buffers(vhMnd_det).
/* resources */
define variable vhResources as handle no-undo.
define variable qhResources as handle no-undo.
create query qhResources in widget-pool "non-persistent".
create buffer vhResources for table "Resources" in widget-pool "non-persistent".
qhResources:set-buffers(vhResources).
do transaction on error undo, throw:
for each tRptMenuSettingsDS2 where
tRptMenuSettingsDS2.tlIsChanged = yes and
tRptMenuSettingsDS2.tlNotFound = no
on error undo, throw :
if tRptMenuSettingsDS2.tlIsUseQRF = yes
then do:
assign vcWhereUri = tcRptOldUri
vcAssignUri = tcRptNewUri.
end.
else do:
assign vcWhereUri = tcRptNewUri
vcAssignUri = tcRptOldUri.
end.
/* mnd_det */
qhMnd_det:query-prepare("for each mnd_det where mnd_uri = " + quoter(vcWhereUri) ).
qhMnd_det:query-open.
qhMnd_det:get-first(EXCLUSIVE-LOCK).
do while not qhMnd_det:query-off-end on error undo, throw:
assign vhMnd_det:buffer-field(vcField1):buffer-value = vcAssignUri.
qhMnd_det:get-next(EXCLUSIVE-LOCK).
end.
qhMnd_det:query-close.
/* resources */
assign vlIsResourceExist = no.
qhResources:query-prepare(" for each resources where resources.resourceURI = " + quoter(vcAssignUri)).
qhResources:query-open.
qhResources:get-first().
do while not qhResources:query-off-end on error undo, throw:
assign vlIsResourceExist = yes.
qhResources:get-next().
end.
qhResources:query-close.
if not vlIsResourceExist
then do:
qhResources:query-prepare(" for each resources where resources.resourceURI = " + quoter(vcWhereUri)).
qhResources:query-open.
qhResources:get-first(EXCLUSIVE-LOCK).
do while not qhResources:query-off-end on error undo, throw:
assign vhResources:buffer-field(vcField2):buffer-value = vcAssignUri.
qhResources:get-next(EXCLUSIVE-LOCK).
end.
qhResources:query-close.
end.
end.
end. /* do transaction: */
finally:
/* delete handlers */
delete object qhMnd_det no-error.
assign qhMnd_det = ?.
delete object vhMnd_det no-error.
delete object qhResources no-error.
assign qhResources = ?.
delete object vhResources no-error.
end finally.