project QadFinancials > class BPostingTemplate > method CalcLayerTypeCodeTr

query calculated fields procedure

Description

Assign a value to query calculated field tqSelectPostingTemplate.tcLayerTypeCodeTr (available in preprocessor {&tcLayerTypeCodeTr})


Parameters


iiCompanyIdinputintegerCompany id
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
query SelectPostingTemplate


program code (program1/bpostingtemplate.p)

if vcListLayerTypeCodes = "":U
then assign vcListLayerTypeCodes = {&LAYERTYPECODES}.

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:
    assign {&tcLayerTypeCodeTr} = "?":U.
    do viCounter = num-entries(vcListLayerTypeCodes, chr(2)) to 1 by -2 :
        if entry(viCounter,vcListLayerTypeCodes, chr(2)) = {&tcLayerTypeCode}
        then do :
            assign {&tcLayerTypeCodeTr} = entry(viCounter - 1, vcListLayerTypeCodes, chr(2)) no-error.
            leave.
        end. /* if entry */
    end.
    vhQuery:get-next().
end.
vhQuery:query-close().
delete object vhQuery.