icRowids | input | character | Comma separated list of rowids of objects to include in the XML file |
icFile | input | character | Full path name of the file in which the XML should be dumped. |
ilHeaderOnly | input | logical | When true, only the main table will be included in the generated XML representation. |
ilSuppressEmptyFields | input | logical | When 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. |
iiPriority | input | integer | If Priority is different from 0, an additional tag (Priority) will be added in the header of the XML object. |
ilWriteXMLSchema | input | logical | When true, also include the metaschema in the XML file. |
icObjectRowId | input | character | If you want to restrict dumped data to a single object, pass the rowid of the object. Otherwise leave blanc, and all objects identified by icRowids will be dumped. |
ilExportForInput | input | logical | When 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) |
oiReturnStatus | output | integer | Return status of the method. |
<M-1 run DataLoad (input icRowids (icRowids), input '':U (icPkeys), input '':U (icObjectIds), input '':U (icFreeform), input false (ilKeepPrevious), output viFcReturnSuper (oiReturnStatus)) in database> if viFcReturnSuper < 0 or oiReturnStatus = 0 then assign oiReturnStatus = viFcReturnSuper. if oiReturnStatus < 0 then return. <M-2 run DumpXmlRepresentation (input icFile (icFile), input ilHeaderOnly (ilHeaderOnly), input ilSuppressEmptyFields (ilSuppressEmptyFields), input iiPriority (iiPriority), input ilWriteXMLSchema (ilWriteXMLSchema), input icObjectRowId (icObjectRowId), input ilExportForInput (ilExportForInput), output viFcReturnSuper (oiReturnStatus)) in database> if viFcReturnSuper < 0 or oiReturnStatus = 0 then assign oiReturnStatus = viFcReturnSuper. if oiReturnStatus < 0 then return.
define temp-table ttContext no-undo field propertyQualifier as character field propertyName as character field propertyValue as character index entityContext is primary unique propertyQualifier propertyName index propertyQualifier propertyQualifier. define dataset dsContext for ttContext. define variable vhContextDS as handle no-undo. define variable vhExceptionDS as handle no-undo. define variable vhServer as handle no-undo. define variable vhInputDS as handle no-undo. define variable vhInputOutputDS as handle no-undo. define variable vhOutputDS as handle no-undo. define variable vhParameter as handle no-undo. /* Create context */ create ttContext. assign ttContext.propertyName = "programName" ttContext.propertyValue = "database". create ttContext. assign ttContext.propertyName = "methodName" ttContext.propertyValue = "ApiDumpXmlRepresentation". create ttContext. assign ttContext.propertyName = "applicationId" ttContext.propertyValue = "fin". create ttContext. assign ttContext.propertyName = "entity" ttContext.propertyValue = "1000". create ttContext. assign ttContext.propertyName = "userName" ttContext.propertyValue = "mfg". create ttContext. assign ttContext.propertyName = "password" ttContext.propertyValue = "". /* Create input dataset */ create dataset vhInputDS. vhInputDS:read-xmlschema("file", "xml/database.apidumpxmlrepresentation.i.xsd", ?). vhParameter = vhInputDS:get-buffer-handle("tParameterI"). vhParameter:buffer-create(). assign vhParameter::icRowids = <parameter value> vhParameter::icFile = <parameter value> vhParameter::ilHeaderOnly = <parameter value> vhParameter::ilSuppressEmptyFields = <parameter value> vhParameter::iiPriority = <parameter value> vhParameter::ilWriteXMLSchema = <parameter value> vhParameter::icObjectRowId = <parameter value> vhParameter::ilExportForInput = <parameter value>. /* Connect the AppServer */ create server vhServer. vhServer:connect("-URL <appserver-url>"). if not vhServer:connected() then do: message "Could not connect AppServer" view-as alert-box error title "Error". return. end. /* Run */ assign vhContextDS = dataset dsContext:handle. run program/rpcrequestservice.p on vhServer (input-output dataset-handle vhContextDS by-reference, output dataset-handle vhExceptionDS, input dataset-handle vhInputDS by-reference, input-output dataset-handle vhInputOutputDS by-reference, output dataset-handle vhOutputDS). /* Handle output however you want, in this example, we dump it to xml */ if valid-handle(vhExceptionDS) then vhExceptionDS:write-xml("file", "Exceptions.xml", true). if valid-handle(vhOutputDS) then vhOutputDS:write-xml("file", "Output.xml", true). /* Cleanup */ vhServer:disconnect(). assign vhServer = ?. if valid-handle(vhInputDS) then delete object vhInputDS. if valid-handle(vhOutputDS) then delete object vhOutputDS. if valid-handle(vhExceptionDS) then delete object vhExceptionDS.