Community articleLoading a Form
Added by IBM contributorIBM on May 6, 2011
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars

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

   private static void loadForm() throws Exception

  1. Before you can load the form, declare the XFDL object:
  2.    XFDL theXFDL;

  3. Use IFSSingleton.getXFDL to assign the XFDL object to theXFDL. This allows you to access the root node of the form.
  4.     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.

  5. Call the API method readForm to load the form into memory. The method returns a reference to the root node of the form.
  6.    theForm = theXFDL.readForm("calculateAge.xfd", 0);

    • The argument "calculateAge.xfd" is the name of the form to read from the local drive.

Parent topic: Developing an application in Java