project BLF > class BScanDaemon > method DefaultCompanyDescription

Description

Returnes the company description for a given company code.


Parameters


icRowIdinputcharacter
icCompanyCodeinputcharacter
ocCompanyDescriptionoutputcharacter
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


unused


program code (program1/bscandaemon.p)

if icRowId = '' or icRowId = ?
then return.

find first bScanDaemonLocation where
           bScanDaemonLocation.tc_Rowid = icRowId no-error.

if not available bScanDaemonLocation
then return.

if icCompanyCode = '' or icCompanyCode = ?
then do: 
    assign bScanDaemonLocation.tcCompanyCode = ''
           bScanDaemonLocation.tcCompanyDescription = ''.
    return.
end.

if bScanDaemonLocation.tcCompanyCode <> icCompanyCode
then assign bScanDaemonLocation.tcCompanyCode = icCompanyCode
            bScanDaemonLocation.tcCompanyDescription = ''.

if bScanDaemonLocation.tcCompanyDescription = ''
then do:
    <Q-1 run CompanyByAll (all) (Read) (NoCache)
       (input ?, (CompanyId)
        input icCompanyCode, (CompanyCode)
        input ?, (CompanyIsActive)
        output dataset tqCompanyByAll) in BCompany >
    find first tqCompanyByAll where
               tqCompanyByAll.tcCompanyCode = bScanDaemonLocation.tcCompanyCode no-error.
    if available tqCompanyByAll
    then assign bScanDaemonLocation.tcCompanyDescription = tqCompanyByAll.tcCompanyDescription.
end.

assign ocCompanyDescription = bScanDaemonLocation.tcCompanyDescription.