Sample: Action for an item XML

This script is an example of creating XML for an item.
Option Strict Off
Imports System
Imports System.Diagnostics
Class ActionScript
inherits FcProcFuncSetEventWF
Function wf_start() As Long
Dim WebReportPath as String
Dim XMLJobFile as New XmlDocument
Dim ItemData as String
Dim ItemDataXML as New XmlDocument
Dim ItemDataHeader as XmlNode
Dim ImportNode as XmlNode
Dim ImportLoc as XmlNode
WebReportPath = "C:\Inetpub\wwwroot\FsWebReports\"
‘Load the WebReport template file that is specific to this report. It already has the ‘Item
schema listed in it. You can create this file by copying the generic template ‘and use a text
editor to add the additional Schema information to the copy.
XMLJobFile.Load(WebReportPath & "Source\FsWebReportTemplateItem.xml")
‘Fetch the Item data and load it into an XMLDocument object
ItemData = ObjectXML("ITEM", "", "HEADER;TPALL")
‘Remove the XML Namespace that was added by default.
‘This allows for easier XPath searching below
ItemData = System.Text.RegularExpressions.Regex.Replace(ItemData,
"<fsxml.*?>", "<fsxml>")
ItemDataXML.LoadXml(ItemData)
‘Find the top-level Item node that will be imported into the job file
ItemDataHeader = ItemDataXML.SelectSingleNode("//FSITEM")
‘Create a copy of this node that belongs to the Job file.
‘This node can then be inserted into the Job file.
ImportNode = XMLJobFile.ImportNode(ItemDataHeader, True)
‘Find the place in the Job file to insert the imported data
‘This should be inserted as a child node into the <object> node
ImportLoc = XMLJobFile.SelectSingleNode("//object")
‘Insert the node into the Job file
ImportLoc.AppendChild(ImportNode)
' Save the job file to the Web Reports folder. The SessionXML\ is optional.
XMLJobFile.Save(WebReportPath & "SessionXML\FsWB_Item_Data.xml")
' Start Web Reports passing the RPT and XML file names. Enter a full path to the
‘ XML file if it is not in the default SessionXML directory.
ShellAPI("http://localhost/FsWebReports/
Launch.aspx?p1=FSWB_Item_Data.xml&p2=ITEM&p3=pdf&p4=" & WebReportPath &
"Source\FSWB_Item_Data.rpt")
End Function
End Class

XML output for an item (also known as a job file) is shown here.

XML output item

If you are exporting basic Optiva attachments for multiple objects for a report, rename the generic FSDOC and FSEMBEDDEDOBJECTS tables in the <rename> sections of the XML file to match the objects.

Attached files, documents and URLs do not need any preparation for multiple object types. The default value is the table name with each object type, e.g., FSFORMULAATTACH, FSITEMATTACH.

Attaching mutiple objects for project