project QadFinancials > class BDCollection > 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/bdcollection.p)

<ANCESTOR-CODE>

if icTableName = "DCollection":U
then assign tDCollection.Company_ID              = viCompanyId
            tDCollection.CreationUsr_ID          = viUsrId
            tDCollection.DCollectionCreationDate = today
            tDCollection.DCollectionCreationTime = time.

if icTableName = "DCollectionExport":U
then do:
     <Q-1 run DCollectionExportByID (last) (Read) (NoCache)
          (input ?, (DCollectionExportID)
           input ?, (DCollectionID)
           output dataset tqDCollectionExportByID) in BDCollection >
    

    find tDCollection where
         tDCollection.tc_Rowid = tDCollectionExport.tc_ParentRowid
         no-error.

    assign tDCollectionExport.DCollectionExportDate     = today
           tDCollectionExport.DCollectionExportIsDuplic = can-find(first bDCollectionExport where
                                                                         bDCollectionExport.tc_ParentRowid = tDCollection.tc_Rowid and
                                                                         bDCollectionExport.tc_Rowid      <> tDCollectionExport.tc_Rowid)
           tDCollectionExport.DCollectionExportFolder   = "*":U
           tDCollectionExport.DCollectionExportTime     = time
           tDCollectionExport.DCollectionExportType     = tDCollection.DCollectionBankFileFormat
           tDCollectionExport.DCollectionExportSpilDate = tDCollection.DCollectionRequestedDate
           tDCollectionExport.tcExportTime              = string(tDCollectionExport.DCollectionExportTime, "HH:MM:SS":U)
           tDCollectionExport.tcUsrLogin                = vcUserLogin.

    find first tqDCollectionExportByID no-error.
    if AVAILABLE tqDCollectionExportByID                    and
       tqDCollectionExportByID.tcDCollectionExportFile <> ? and
       tqDCollectionExportByID.tcDCollectionExportFile <> "":U
    then do:
        assign  viDummy                                  = num-entries(tqDCollectionExportByID.tcDCollectionExportFile, "~\":U)
                tDCollectionExport.DCollectionExportFile = trim(tqDCollectionExportByID.tcDCollectionExportFile, entry(viDummy,tqDCollectionExportByID.tcDCollectionExportFile, "~\":U)).
    end.
end.