Sample: Sending input parameters to the job file
You specified input parameters data types in the report XSD schema. This prepares the job file for input parameter data.
This example reads the report XML file (job file) and updates the
InputParams
node to output all three possible data types (date, number,
text) for Workflow input parameters.
In this example, because the location of the template file has not been set up in the File Location form, it is hard coded into the workflow.
The sub function AddWFParamToXML()
should be stored in a script library
rather than scripting it in each Report action script.
Option Strict Off
Imports System
Imports System.Diagnostics
Class ActionScript
Inherits FcProcFuncSetEventWF
Function wf_start() As Long
Dim templ As New XmlDocument()
templ.Load("http://localhost/FsWebReports/Source/
FsWebReportTemplate.xml")
Dim dateParam1 As Date = CDate(WipParamGet("DATE1"))
Dim dateParam2 As Date = CDate(WipParamGet("DATE2"))
Dim numberParam1 As String = WipParamGet("NUMBER1")
Dim numberParam2 As String = WipParamGet("NUMBER2")
Dim textParam1 As String = WipParamGet("STRING1")
Dim textParam2 As String = WipParamGet("STRING2")
AddWFParamToXML(templ, 0, "dateInput1", dateParam1.ToString("s"))
AddWFParamToXML(templ, 0, "dateInput2", dateParam2.ToString("s"))
AddWFParamToXML(templ, 1, "numberInput1", numberParam1)
AddWFParamToXML(templ, 1, "numberInput2", numberParam2)
AddWFParamToXML(templ, 2, "textInput1", textParam1)
AddWFParamToXML(templ, 2, "textInput2", textParam2)
Return 111
End Function
Private Sub AddWFParamToXML(ByRef xml As XmlDocument, ByVal paramType As
Integer, ByVal nodeName As String, ByVal nodeVal As String)
' paramType: 0=date; 1=number; 2=text
Dim params As XmlNode = xml.SelectSingleNode("//inputparams")
Dim nodeBaseName As String
Select Case paramType
Case 0 : nodeBaseName = "dateparam"
Case 1 : nodeBaseName = "numberparam"
Case 2 : nodeBaseName = "textparam"
End Select
Dim param As XmlElement = xml.CreateElement(nodeBaseName)
Dim nodeNmAttr As XmlAttribute = xml.CreateAttribute("name")
nodeNmAttr.InnerText = nodeName
param.Attributes.Append(nodeNmAttr)
param.InnerText = nodeVal
params.AppendChild(param)
End Sub
End Class