project BLF > class BCompany > 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/bcompany.p)

<ANCESTOR-CODE>

if icTableName = "company":U
then do:

    assign tCompany.CompanyIsActive = yes.

    /* create companysharedset lines */
    assign vcListSharedSetTypeCode = <M-3 GetSharedSetTypes () in BCompany>
           viNumberOfEntries       = num-entries(vcListSharedSetTypeCode, chr(2))
           viEntry                 = 1.
    /* for every SharedSetType create a new line */
    do while viEntry + 1 <= viNumberOfEntries:
        <M-1 run AddDetailLine (input  'CompanySharedSet':U (icTable), 
                        input  tCompany.tc_Rowid (icParentRowid), 
                        output viFcReturnSuper (oiReturnStatus)) in BCompany>
        if viFcReturnSuper <> 0
        then do:
             <M-2 run SetMessage
          (input  #T-1'Add detail line for entity shared set failed.':60(6604)t-1# (icMessage), 
           input  '' (icArguments), 
           input  '' (icFieldName), 
           input  '' (icFieldValue), 
           input  'E':U (icType), 
           input  2 (iiSeverity), 
           input  '' (icRowid), 
           input  'BLF-48':U (icFcMsgNumber), 
           input  '' (icFcExplanation), 
           input  '' (icFcIdentification), 
           input  '' (icFcContext), 
           output viFcReturnSuper (oiReturnStatus)) in BCompany>
            assign oiReturnStatus = -8.
        end.
        if available tCompanySharedSet
        then do:
            assign tCompanySharedSet.tcSharedSetTypeTranslated = entry(viEntry, vcListSharedSetTypeCode, chr(2))
                        tCompanySharedSet.tcSharedSetTypeCode       = entry(viEntry + 1, vcListSharedSetTypeCode, chr(2)).
        end.
        assign viEntry = viEntry + 2.
    end.
end.

/* ============================================================================================= */
/* KriLae 20050704: keep these this find statemants because otherwise method ApiSynchronise does */
/* not work correctly. Reason for this strange behaviour is not clear to KriLae nor to KriMae    */
/* ============================================================================================= */
find first tCompany no-error.