project QadFinancials > class BCInvoice > method CalcAllSelectCInvoicePO
query calculated fields procedure
Description
Assign a value to query calculated fields
Parameters
| iiCompanyId | input | integer | Company id |
| oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program1/bcinvoice.p)
assign vcListAllocStatuses = {&ALLOCSTATUSS}
vcListInvoiceTypes = {&INVOICETYPES}.
create query vhQuery in widget-pool "non-persistent".
vhQuery:set-buffers(ih_Buffer).
vhQuery:query-prepare("for each ":U + ih_Buffer:table).
vhQuery:query-open().
vhQuery:get-first().
do while not vhQuery:query-off-end:
/* CalcCInvoiceAllocationStatusCalc */
assign {&tcCInvoiceAllocationStatusCalc} = "?":U.
do viCounter = num-entries(vcListAllocStatuses, chr(2)) to 1 by -2:
if entry(viCounter, vcListAllocStatuses, chr(2)) = {&tcCInvoiceAllocationStatus}
then do:
assign {&tcCInvoiceAllocationStatusCalc} = entry(viCounter - 1, vcListAllocStatuses, chr(2)) no-error.
leave.
end.
end.
/* CalcCInvoiceTypeCalc */
/* work with a do because the translated and untranslated values can be the same */
assign {&tcCInvoiceTypeCalc} = "?":U.
do viCounter = num-entries(vcListInvoiceTypes,chr(2)) to 1 by -2 :
if entry(viCounter,vcListInvoiceTypes,chr(2)) = {&tcCInvoiceType}
then do :
assign {&tcCInvoiceTypeCalc} = entry(viCounter - 1,vcListInvoiceTypes,chr(2)) no-error.
leave.
end. /* if entry */
end.
vhQuery:get-next().
end.
vhQuery:query-close().
delete object vhQuery.