Loading a Form

Before your program can begin working with a form, you must load it into memory. CalculateAge does this by defining a loadForm functionmethodfunction to handle these tasks.

   private static void loadForm() throws Exception
      {
  1. Before you can load the form, declare the XFDL object:
       XFDL theXFDL;
    
  2. Use IFSSingleton.getXFDL to assign the XFDL object to theXFDL. This allows you to access the root node of the form.
        theXFDL = IFSSingleton.getXFDL();
             if(theXFDL == null)
                throw new Exception("Could not find interface");
    
    • The loadForm method uses the Form Library method readForm to load the form into memory. Before you can use readForm> you must retrieve the XFDL object.
  3. Call the API method readForm to load the form into memory. The method returns a reference to the root node of the form.
       theForm = theXFDL.readForm("calculateAge.xfd", 0);
          }
    
    • The argument "calculateAge.xfd" is the name of the form to read from the local drive.