project QadFinancials > class BDeductionCat > method CalcDeductionCatTypeCalc

query calculated fields procedure

Description

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


Parameters


iiCompanyIdinputintegerCompany id
iiDomainIdinputinteger
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
query SelectDeductionCat


program code (program1/bdeductioncat.p)

assign vcListDedCatTypes = {&DEDUCTIONCATTYPES}.

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:
    /* work with a do because the translated and untranslated values can be the same */
    assign {&tcDeductionCatTypeCalc} = "?":U.
    do viCounter = num-entries(vcListDedCatTypes,chr(2)) to 1 by -2 :
        if entry(viCounter,vcListDedCatTypes,chr(2)) = {&tcDeductionCatType}
        then do :
            assign {&tcDeductionCatTypeCalc} = entry(viCounter - 1,vcListDedCatTypes,chr(2)) no-error.
            leave.
        end. /* if entry */
    end.   
    
    vhQuery:get-next().

end.
vhQuery:query-close().
delete object vhQuery.