project QadFinancials > class BCMask > method InitialValues

Description

Add code here to initialize the calculated fields of a 'new' record (= a record that must be created in the application database) in a class temp-table.


Parameters


icTableNameinputcharacterName of the database table of which a record is created in the class temp-table.
oiReturnStatusoutputinteger


Internal usage


unused


program code (program/bcmask.p)

define buffer bSharedSet for SharedSet.

<ANCESTOR-CODE>

if icTableName = "CMask":U
then do on error undo, leave:
    
    assign tCMask.CMaskIsActive = true.
    
    /*SharedSet_ID linked to the current company (viCompanyId)*/
    assign vcSharedSetTypeCode = {&SHAREDSETTYPECODE-JOURNAL}.
    
    <Q-28 run LookupSharedSetForCompany (all) (Read) (Cache)
       (input viCompanyId, (CompanyId)
        input vcSharedSetTypeCode, (SharedSetType)
        output dataset tqSharedSetForCompany) in BCompany>
    
    find first tqSharedSetForCompany where
               tqSharedSetForCompany.tiCompany_ID        = viCompanyId and
               tqSharedSetForCompany.tcSharedSetTypeCode = vcSharedSetTypeCode
               no-error.
                              
    if available tqSharedSetForCompany
    then do:
        assign tCMask.SharedSet_ID = tqSharedSetForCompany.tiSharedSet_ID.
        
        for each bSharedSet fields (SharedSet_ID SharedSetCode SharedSetDescription) no-lock where
                 bSharedSet.SharedSet_ID = tCMask.SharedSet_ID on error undo, throw:
                 
            tCMask.tcSharedSetCode = bSharedSet.SharedSetCode.
            
            if vlObjectTranslationsActive
            then do:
                run GetTranslationForObject /* in componentpool */
                   (input bSharedSet.SharedSet_ID,
                    input current-language,
                    input bSharedSet.SharedSetDescription,
                    input "SharedSetDescription",
                    output tCMask.tcSharedSetDescription,
                    output viFcReturnSuper).
                if viFcReturnSuper <> 0
                then oiReturnStatus = viFcReturnSuper.
                if viFcReturnSuper < 0
                then return.
            end.
            else tCMask.tcSharedSetDescription = bSharedSet.SharedSetDescription.
        end.
    end.
    
end. /* if icTableName = "CMask":U */