# Customized Panes for 'xxxxxxxx' Created: 2010/02/03 # PANE:Custom Form [PANE] Phil IMPMENLZ 01000Custom Fields 090 000000500000IMPMEN030M000 0000 00000 [VBSCRIPT] ' This script contains functions for form and field events. ' You must not modify the name of the functions. Option Explicit Function CustomizedPane_OnLoad() dim CustomFormType CustomFormType = CustomizedPane.CodeObject.CustomFormType ' Specify the variables to be used to call the COMQFM business object, and contain the results. ' When called without a element, only the structure is returned. This structure is used ' to build the form. dim XMLOut, XMLParam ' Build the XML required for COMQFM to return the custom form structure. XMLParam = XMLParam & " " on error resume next ' Call the business object and return the results to the variable XMLOut XMLOut = CallBO("COMQFM",XMLParam,"auto") if err then CustomizedPane.CodeObject.ListviewData = " " exit function end if ' Switch on error handling on error goto 0 ' The next section builds the structure of the form. ' These are the variables that will be used when extracting the relevant information from the output ' of COMQFM. There can be are multiple sections in this output. As the number of them is not ' known, they are read in to xList and a For/Next loop used to cycle through it. dim FormProp, XMLDoc, xList, Counter, FieldPrompt, FieldType, FieldLength, FieldDecimals ' Define the opening elements of the structure before the loop, so they only occur once. FormProp = FormProp & "
" ' Load the output from the business object in to the DOM Set XMLDoc = createobject("MSXML2.DOMDocument") XMLDoc.async = false XMLDoc.LoadXML(XMLOut) ' Look for all the Field elements and put them in to the variable xList Set xList = XMLDoc.SelectNodes("//Field") ' Loop through each of the Field elements For Counter = 0 To xList.length - 1 ' For each loop through, extract the following information FieldPrompt=xList(Counter).SelectSingleNode("Prompt").Text FieldType=xList(Counter).SelectSingleNode("Type").Text FieldLength=xList(Counter).SelectSingleNode("Length").Text FieldDecimals=xList(Counter).SelectSingleNode("Decimals").Text ' Build up a detail line of the structure for each loop through. ' Check to see if the FieldType is set to N (Numeric). If it is, the number of decimals is required. If FieldType <> "N" then FormProp = FormProp & "" Else FormProp = FormProp & "" End If Next ' Define the closing elements of the structure after the loop, so they only occur once. FormProp = FormProp & "
" ' Destroy the occurence of the DOM Set XMLDoc = Nothing ' Load the structure that has been defined in to the FormProperties variable so that it can be displayed CustomizedPane.CodeObject.FormProperties = FormProp End Function Function CustomizedPane_OnRefresh() dim CustomFormType CustomFormType = CustomizedPane.CodeObject.CustomFormType dim Notekey Notekey = CustomizedPane.CodeObject.RefreshValue if Notekey = "" then CustomizedPane.CodeObject.UpdateFormValues = " " exit function end if ' Specify the variables to be used to call the COMQFM business object, and contain the results. dim XMLOutv, XMLParamv ' Build the XML used to call the COMQFM business object. ' The element must contain a valid custom form type. The list of valid types is held in the ' IMPCFM.IMP file. XMLParamv = " " on error resume next ' Call the business object and return the results to the variable XMLOutv XMLOutv = CallBO("COMQFM",XMLParamv,"auto") if err then exit function end if ' Switch on error handling on error goto 0 ' These are the variables that will be used when extracting the relevant information from the output ' of COMQFM. There can be are multiple sections in this output. As the number of them is not ' known, they are read in to xList and a For/Next loop used to cycle through it. dim XMLDocv, xListv, Counterv, FieldPromptv, FieldValuev, FormData ' Define the opening elements of the values before the loop, so they only occur once. FormData = "
" ' Load the output from the business object in to the DOM Set XMLDocv = createobject("MSXML2.DOMDocument") XMLDocv.async = false XMLDocv.LoadXML(XMLOutv) ' Look for all Field elements Set xListv = XMLDocv.SelectNodes("//Field") ' Loop through each of the WarehouseItem elements For Counterv = 0 To xListv.length - 1 ' For each loop through, extract the following information FieldPromptv=xListv(Counterv).SelectSingleNode("Prompt").Text FieldValuev=xListv(Counterv).SelectSingleNode("Value").Text ' Build up a detail line of the value XML for each loop through. FormData = FormData & "" Next ' Define the closing elements of the structure after the loop, so they only occur once. FormData = FormData & "
" ' Destroy the occurence of the DOM Set XMLDocv = Nothing ' Load the values XML that has been defined in to the UpdateFormValues variable so that it can be displayed CustomizedPane.CodeObject.UpdateFormValues = FormData End Function