Community articleAbout Functions, Packages and Extensions
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

The purpose of the FCI is to make the functionality of forms extensible without requiring updates to your forms driver software. This API allows you to create self-contained modules called extensions that provide packages of functions for use in XFDL forms.
Note: The forms driver software is any application that initializes and calls on the API.
Functions can be used almost anywhere in an XFDL form; the appropriateness of their use depends mainly on their behavior. For instance the XFDL Specification contains a default package of functions called system. Every application built with the API version 4.4 or greater can use these functions.
Functions are grouped together to form packages. When you call a function from a form, you must include the function's package name in the call. For example, the function beep is part of the package called my_funcs. To call the beep function from a form and assign the result to the form option do_beep you would type the following:
   <label sid = "do_beep">
      <value compute = "my_funcs.beep( )"></value>
   </label>

The most common use of a function is to return a value that is used to set a form option, such as the value of a field. For example, the toupper function in the system package, which converts a string to uppercase and returns the result, might be used to set the value of a particular form field. This method could take as its sole argument the value of a label elsewhere on the form (or on another form) and convert it to uppercase as follows:
   <label sid = "SomeLabel">
      <value>"I am a label"</value>
   </label>
   <field sid = "SomeField">
      <size>
         <ae>20</ae>
         <ae>1</ae>
      </size>
      <value compute = "system.toupper(SomeLabel.value)"></value>
   </field>

FunctionCall: To create a package of functions you must create an extension. The extension provides services for function calls via an object. The FunctionCall object contains your package(s) of custom-built functions.
View of functions inside a package.


Refer to the The FCI Extension Architecture for more information. .
Use the following rules to help you define your own packages and extensions:
  • Each package can contain multiple functions.
  • Each extension can contain multiple packages, however it is easier to define one package per extension.
  • All package names must contain an underscore. IBM® reserves all other package names.
  • The XFDL Specification contains a default package of functions called system. Every application built with the API version 4.4 or greater can use these functions.
  • You cannot add to the system package of functions. For details on the system functions, see the XFDL Specification.
Once you have created your extensions you can embed them directly into XFDL forms, or you can distribute them to users as Java Archive files (JARs) or as ZIP files.
Note: In order to view the forms provided with this API, you must have a licensed or evaluation copy of IBM Forms Viewer installed.

Related concepts
Related tasks