project QadFinancials > class BGLCalendar > method DataLoadMultiple

Description

This method is used to load period records for a calendar year


Parameters


iiPeriodYearinputintegerCalendar year for the periods to be loaded
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


unused


program code (program1/bglcalendar.p)

/* Validate input parameter */
if iiPeriodYear = ? or iiPeriodYear = 0
then do:
    assign vcMessage = trim(#T-1'You must specify the GL calendar year that you want to load.':100(2333)t-1#)
           oiReturnStatus = -1.

    <M-2 run SetMessage (input  vcMessage (icMessage), 
                     input  '':U (icArguments), 
                     input  '':U (icFieldName), 
                     input  '':U (icFieldValue), 
                     input  'E':U (icType), 
                     input  3 (iiSeverity), 
                     input  '':U (icRowid), 
                     input  '-120':U (icFcMsgNumber), 
                     input  '':U (icFcExplanation), 
                     input  '':U (icFcIdentification), 
                     input  '':U (icFcContext), 
                     output viFcReturnSuper (oiReturnStatus)) in BGLCalendar>

    return.
end.

/* Clear the instance */
<M-3 run ClearData (output viFcReturnSuper (oiReturnStatus)) in BGLCalendar>

if viFcReturnSuper <> 0
    then do:
    assign oiReturnStatus = viFcReturnSuper.
    return.
end.

/* Load the period records for the input year */
<Q-4 run GLCalendarByYearPeriod (all) (Read) (NoCache)
          (input viDomainID, (DomainId)
           input iiPeriodYear, (CalendarYear)
           input 0, (CalendarPeriod)
           input ?, (GLCalendarId)
           output dataset tqGLCalendarByYearPeriod) in BGLCalendar >

assign vcList = "":U.

for each tqGLCalendarByYearPeriod where
         tqGLCalendarByYearPeriod.tiDomain_ID = viDomainID and
         tqGLCalendarByYearPeriod.tiGLCalendarYear = iiPeriodYear
         no-lock:
    find tGLCalendar where
         tGLCalendar.GLCalendar_ID = tqGLCalendarByYearPeriod.tiGLCalendar_ID
         no-error.
    if not available tGLCalendar
    then do:
        if vcList = "":U then assign vcList = string (tqGLCalendarByYearPeriod.tiGLCalendar_ID).
        else if lookup (string(tqGLCalendarByYearPeriod.tiGLCalendar_ID),vcList,chr(4)) = 0 then
            assign vcList = vcList + chr(4) + string (tqGLCalendarByYearPeriod.tiGLCalendar_ID).
    end.
end.    
    
if vcList <> "":U
then do:
    <M-5 run DataLoad (input  '':U (icRowids), 
                   input  vcList (icPkeys), 
                   input  '':U (icObjectIds), 
                   input  '':U (icFreeform), 
                   input  true (ilKeepPrevious), 
                   output viFcReturnSuper (oiReturnStatus)) in BGLCalendar>

    if viFcReturnSuper <> 0
    then do:
        assign oiReturnStatus = viFcReturnSuper.
        return.
    end.
end.