project BLF > class Database Component > method DumpXmlRepresentation

Description

Write an XML file with the object data of the database object(s) currently in memory.
This XML file uses the standard schema found in <server installation folder>/xml/<class>.xsd.
It can be used as input for method ApiMaintainByXML and for the XML daemon.


Parameters


icFileinputcharacterFull path name of the file in which the XML should be dumped.
ilHeaderOnlyinputlogicalindicates whether only the main table should be used in the generated XML representation.
ilSuppressEmptyFieldsinputlogicalWhen true, blank fields will be removed from the XML Representation. Blank means empty string, or unknown value for all other data types. Zero is not considered an empty value.
When false, no fields will be removed.
When unknown value, fields with value identical to the default value of that column will be removed. If actual value is the unknown value, and the default value is not unknown value, this unknown value will not be removed.
iiPriorityinputintegerIf Priority is different from 0, an additional tag (Priority) will be supported in the header of the Xml string.
ilWriteXMLSchemainputlogicalAlso include the metaschema in the XML file
icObjectRowIdinputcharacterIf you want to restrict dumped data to a single object, pass the rowid of the object.
Otherwise leave blanc, and all objects in memory will be dumped.
ilExportForInputinputlogicalWhen exporting an XML file to be used for direct input, some fields should be suppressed in the output:
tContextInfo.tcInvolvedCompanyCodes
tContextInfo.tcCorrelationId
tContextInfo.tcObjectIdentifier
all '*_ID' fields
all 'tc_Status' fields
(BLF-1908)
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


BLF
method database.ApiDumpXmlRepresentation
method database.ApiDumpXmlRepresentationV01
method BControlProperty.ApiExportCustomization
method BControlProperty.apiExportFactoryDefaults
method BCustomField.ApiExportCustomFields
method BReportVariant.apiExportCustomization
method BReportVariant.apiExportFactoryDefaults
method BRole.ApiExportRoles
method BSODLog.ApiArchive
method BStoredSearch.ApiExportCustomization
method BStoredSearch.apiExportFactoryDefaults
method BSystem.ApiDumpDefaultSecurity
method BUDCConfiguration.apiExportCustomization
method BUser.ApiDumpUserInXml

QadFinancials
method BAddressType.DumpAddressTypeForConsolid
method BBankNumber.ApiDumpBankNumberInXml
method BBLWICountry.DumpBLWICountryForConsolid
method BBusinessRelation.DumpBusinessRelationForConsolid
method BCostCentre.DumpCostCentreForConsolid
method BCountry.DumpCountryForConsolid
method BCreditor.ApiDumpCreditorInXml
method BCurrency.DumpCurrencyForConsolid
method BDebtor.ApiDumpDebtorInXml
method BDivision.DumpDivisionForConsolid
method BGL.DumpGLForConsolid
method BJournal.DumpJournalForConsolid
method BPosting.ApiDumpPostingInXML
method BJournalEntry.DumpJEForConsolid
method BLayer.DumpLayerForConsolid
method BProfile.DumpProfileForConsolid
method BProject.DumpProjectForConsolid
method BProjectGroup.DumpProjectGroupForConsolid
method BProjectStatus.DumpProjectStatusForConsolid
method BSaf.DumpSafForConsolid
method BSafConcept.DumpSafConceptForConsolid
method BSafStructure.DumpSafStructureForConsolid
method BSafStructureLink.DumpSafStructureLinkForConsolid


program code (program1/database.p)

if icFile = ""
or icFile = ?
or icFile = "?"
then do:
    <M-65 run SetMessage
       (input  #T-91'You must enter the file name.':100(6490)T-91# (icMessage), 
        input  '' (icArguments), 
        input  '' (icFieldName), 
        input  '' (icFieldValue), 
        input  'E' (icType), 
        input  3 (iiSeverity), 
        input  '' (icRowid), 
        input  'blf-105241':U (icFcMsgNumber), 
        input  '' (icFcExplanation), 
        input  '' (icFcIdentification), 
        input  '' (icFcContext), 
        output viFcReturnSuper (oiReturnStatus)) in database>
    oiReturnStatus = -3.
    return.
end.

create x-document vhDocument in widget-pool "non-persistent".

<M-61 run PopulateXDocument
   (input  icObjectRowId (icObjectRowId), 
    input  ilHeaderOnly (ilHeaderOnly), 
    input  ilSuppressEmptyFields (ilSuppressEmptyFields), 
    input  iiPriority (iiPriority), 
    input  ilWriteXMLSchema (ilWriteXMLSchema), 
    input  ilExportForInput (ilExportForInput), 
    input  vhDocument (ihDocument), 
    output viFcReturnSuper (oiReturnStatus)) in database>
if viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.

assign vlFcOk = vhDocument:save("file", icFile) no-error.

if not vlFcOk         or
   error-status:error or
   error-status:num-messages > 0
then do:
    assign vcErrors = "".

    do viCount1 = 1 to error-status:num-messages:
        if vcErrors <> ""
        then assign vcErrors = vcErrors + chr(2).

        assign vcErrors = vcErrors + error-status:get-message(viCount1).
    end.

    <M-7 run SetMessage
       (input  trim(#T-2'Unable to save to file $1.':255(5197)T-2#) (icMessage), 
        input  icFile (icArguments), 
        input  '':U (icFieldName), 
        input  '':U (icFieldValue), 
        input  'E':U (icType), 
        input  3 (iiSeverity), 
        input  '':U (icRowid), 
        input  'BLF-309':U (icFcMsgNumber), 
        input  '':U (icFcExplanation), 
        input  '':U (icFcIdentification), 
        input  '':U (icFcContext), 
        output viFcReturnSuper (oiReturnStatus)) in database>

    if vcErrors <> ""
    then do viCount1 = 1 to num-entries(vcErrors, chr(2)):
        <M-96 run SetMessage
           (input  entry(viCount1, vcErrors, chr(2)) (icMessage), 
            input  '' (icArguments), 
            input  '' (icFieldName), 
            input  '' (icFieldValue), 
            input  'E' (icType), 
            input  3 (iiSeverity), 
            input  '' (icRowid), 
            input  'blf-251139':U (icFcMsgNumber), 
            input  '' (icFcExplanation), 
            input  '' (icFcIdentification), 
            input  '' (icFcContext), 
            output viFcReturnSuper (oiReturnStatus)) in database>
    end.

    assign oiReturnStatus = -1.
end.

finally:
    if vhDocument <> ? then delete object vhDocument.
    for each tXMLTables:
        if tXMLTables.tlStatic
        then delete object tXMLTables.thBuffer no-error.
        else delete object tXMLTables.thTableHandle no-error.
        delete tXMLTables.
    end.
end finally.