Community articleWriteForm function
Added by IBM contributorIBM on July 26, 2013
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars


This function will write a form to the specified file . Call this function on the root node of the form. The version number of the form determines the format of the output file. You can specify whether to compress the output file and whether to observe the transmit and save settings in the form.
If no format is specified, the default is to write the form in the same format in which it was read. If the form in question was created dynamically by your application, WriteForm will, by default, write it as an XFDL form in uncompressed format.


   Sub WriteForm(
      theFilePath As String, 
      triggerItem As IFormNodeP, 
      flags As Long)


Table 1. Function parameters
theFilePathStringThis is the path to the file on the local disk to which the form will be written.
triggerItemIFormNodePThis is the item that caused the form to be submitted. Set to null if the API receives the form in a manner other than transmission.
flagsLongThe following flags are valid:
UFL_TRANSMIT_ALLOW allows the transmit options (that is, transmitdatagroups, transmitgroups, transmititemrefs, transmititems, transmitoptionrefs, transmitpagerefs and transmitoptions) to control which portions of the form are sent. Without this flag, the entire form will be sent regardless of the transmit options in the form.
UFL_SAVE_ALLOW allows the saveformat option to specify what format the form should be saved in. If no format is specified then the form will be saved in the same format that it is read.
Note: Specify 0 if you do not want to enable any of the transmit options.


Returns nothing if the call is successful, or throws an exception if an error occurs.


The following example uses WriteForm to write the form in memory to a file on the local drive.
   Sub SaveForm(Form)
      ' Write the form to a file on disk
      Form.WriteForm "c:\testform.xfd", Nothing, 0
   End Sub

Parent topic:
FormNodeP functions