project BLF > class BReportComm > method GetReportFolders

Description

Returns the location on the server where report files are stored


Parameters


oiReturnStatusoutputintegerReturn status of the method.


Internal usage


BLF
method BReportComm.ApiGetReport
method BReportComm.ApiGetReportGlobalTimeStamp
method BReportComm.ApiGetReportTimeStamps


program code (program1/breportcomm.p)

if oiReturnStatus = 0
then oiReturnStatus = -98.

if vcStandardReports = ""
then do:
    vhFcComponent = ?.
    <M-1 run MainBlock  () in XML>
    vhXMLhandle = vhFcComponent.
    <M-2 run ReadXMLNodeValue
       (input  search('server.xml') (icXMLFile), 
        input  'reports' (icStartTag), 
        input  'customreports' (icNodeTag), 
        output vcCustomerReports (ocNodeValue), 
        output viFcReturnSuper (oiReturnStatus)) in XML>
    if index(vcCustomerReports,"$ENVROOT") > 0
    then do:
        vhFcComponent = vhXMLhandle.
        <M-3 run ReadXMLNodeValue
           (input  search('server.xml') (icXMLFile), 
            input  'serverConfiguration' (icStartTag), 
            input  'ENVROOT' (icNodeTag), 
            output vcenvroot (ocNodeValue), 
            output viFcReturnSuper (oiReturnStatus)) in XML>
        vcCustomerReports = replace(vcCustomerReports,"$ENVROOT",vcenvroot).
    end.
    run gipr_DeleteProcedure in vhXMLhandle.
    delete procedure vhXMLHandle.
    if viFcReturnSuper <> 0
    then assign oiReturnStatus = viFcReturnSuper.
    if viFcReturnSuper < 0
    then return.
    
    /*
       Validate folder name in server.xml.
       When invalid do not return an error but simply ignore it.
    */
    file-info:file-name = vcCustomerReports.
    if file-info:file-type = ?
    then vcCustomerReports = "".

    do viFcCount1 = num-entries(propath) to 1 by -1:
        assign vcFolder = replace(entry(viFcCount1,propath),"~\","/").
        file-info:file-name = vcFolder + "/crreports".
        if index(file-info:file-type,"D") > 0
        then assign vcStandardReports = vcStandardReports
                                      + (if vcStandardReports = "" then "" else ",")
                                      + file-info:full-pathname.
        ELSE do:
            if vcFolder <> ""
            then ENTRY(NUM-ENTRIES(vcFolder,"/"),vcFolder,"/") = "".
            file-info:file-name = vcFolder + "/crreports".
            if index(file-info:file-type,"D") > 0
            then IF NOT CAN-DO (file-info:full-pathname, vcStandardReports)
                 THEN ASSIGN vcStandardReports = vcStandardReports
                                 + (if vcStandardReports = "" then "" else ",")
                                 + file-info:full-pathname.
        END.
    end.
end.

if oiReturnStatus = -98
then oiReturnStatus = 0.