form Command

A form is a window that displays information related to an object. The Business Administrator designs the form, determining the information to be presented as well as the layout. Forms can be created for specific object types, since the data contained in different types can vary greatly.

For conceptual information on this command, see MQL Concepts:Forms.

This page discusses:

User Level

Business Administrator

Add Form

Use the Add Form command to define a form.

Syntax

add form NAME [ADD_ITEM {ADD_ITEM}];
  • ADD_ITEM provides additional information about the form.

The Add Form clauses are:

[!|not]web
units [picas|points|inches]
description VALUE
rule RULENAME
color [FOREGROUND] [on BACKGROUND]
header HEADER_SIZE
footer FOOTER_SIZE
margins LEFT_MARGIN RIGHT_MARGIN
type TYPE_NAME {,TYPE_NAME}
size WIDTH HEIGHT
field FIELD_TYPE FIELD_DEF
[!|not] hidden
property NAME [to ADMINTYPE NAME] [value STRING]
history STRING

web is used when creating a “Web form.” This distinguishes forms to be used in HTML/JSP applications from those used in the Studio Modeling Platform. With the exception of the Units and Size clauses, all other Add Form clauses are optional. (Units will default to picas if you do not enter a value.) Field clauses specify the field values that should be printed in the form and where. Without at least one Field clause, your form will not have much value.

Units Clause

This clause specifies the units of page measurement. There are three possible values: picas, points, or inches.

units picas
Or
units points
Or
units inches	

Without a unit of measurement, the values of any given header, footer, margin, or field size are not interpreted. Because picas are the default unit of measurement, a picas value is automatically assumed if you do not use a Units clause.

Picas are the most common units of page measurement in the computer industry. Picas use a fixed size for all characters. Determining the size of a field value is easy when using picas as the measurement unit. Simply determine the maximum number of characters that will be used to contain the largest field value. Use that value as your field size. For example, if the largest field value will be a six digit number, you need a field size of six picas. This is not true when using points.

Points are standard units used in the graphics and printing industry. A point is equal to 1/72 of an inch or 72 points to the inch. Points are commonly associated with fonts whose print size and spacing varies from character to character. Unless you are accustomed to working with points, measuring with points can be confusing and complicated. For example, the character “I” might not occupy the same amount of space as the characters “E” or “O.” To determine the maximum field size, you need to know the maximum number of characters that will be used and the maximum amount of space required to express the largest character. Multiply these two numbers to determine your field size value.

Inches are common English units of measurement. While you can use inches as your unit of measurement, be aware that field placement can be difficult to determine and specify. Each field is composed of character string values. How many inches does each character need or use? If the value is a four-digit number, how many inches wide must the field be to contain the value? How many of these fields can you fit across a form page? Considering the problems involved in answering these questions, you can see why picas are a favorite measuring unit.

Rule Clause

Rules are administrative objects that define specific privileges for various users. The Rule clause enables you to specify an access rule to be used for the form.

add form NAME rule RULENAME;

Color Clause

This clause specifies color values used as the default foreground and background for the form.

add form color [FOREGROUND |on BACKGROUND |]
  • FOREGROUND is the name of the color for the foreground printed information (any vertical or horizontal lines of information).
  • BACKGROUND is the name of the color used as an overall background for the form. The word on is required only if a background color is specified.

For a list of available colors, see:

  • Windows: \$MATRIXHOME\lib\winnt\rgb.txt
  • UNIX: /$MATRIXHOME/lib/ARCH/rgb.txt

$MATRIXHOME is where Collaboration and Approvals is installed and ARCH is the UNIX platform.

Header Clause

This clause places a border at the top of the page. It specifies the number of lines, points, or inches that should be measured down from the top of the page. While inserting a Header clause defines an upper border, it does not prevent you from placing information within that border. Header clauses are often used with page titles. You might want to place title information within the header with the values below it.

The following command creates a form named “Material Properties.” Measured in picas, the form is 80 characters wide and 60 lines long.

add form "Material Properties"
   units picas
   size 80 60
   header 6

Footer Clause

This clause is similar to the Header clause. It places a border at the bottom of the page by specifying the number of lines, points, or inches that should be measured up from the bottom of the page. While inserting a Footer clause defines a lower border, it does not prevent you from placing information within that border.

Footer clauses are often used n with display rules and page footnotes (such as page numbers or titles). When you define a footer, you are defining where a rule line can be placed. You might want to place your footnote information below that rule line. This information might consist of summary values, orientation material (such as a page number and title), or special information (such as warning flags).

add form "Material Properties"
   units picas
   size 80 60
   footer 6

Margins Clause

This clause specifies a left and right border on each page:

add form margins LEFT_MARGIN RIGHT_MARGIN
  • LEFT_MARGIN is the number of units from the left page edge. Always specify this value first.
  • RIGHT_MARGIN is the number of units from the right page edge.

For example, assume you want to include margins in a “Material Properties” form definition:

add form "Material Properties"
   units picas
   size 80 60
   header 3
   footer 3
   margins 5 10;

In this example, the left margin is set as five characters in from the left page edge. The right margin is set as ten characters in from the right page edge. Since the page size is set as 80 characters, this means that the center working area is equal to 65 characters.

When including a Margins clause in an Add Form command, you must always specify two values even if you only want one margin. This determines which value is the left margin offset and which is the right. For example, to define only a right margin, use can use this Margins clause:

margins 0 5

The left margin is defined as the left page edge (0). The right margin is then defined as five characters in from the right page edge. This gives you a new working area of 75 characters in width.

add form "Label List"
   units picas
   size 40 12
   header 1
   footer 1
   margins 5 5;

With the inclusion of the Margins clause, you have a working area that is 30 characters wide. The left margin is at five characters from the left edge and the right margin is at five characters from the right edge. Since the right edge is at 40 characters, this definition is equivalent to saying that the right edge is at 35 characters.

Type Clause

This clause lists business types that the form is associated with. When a business object is highlighted and the Form option is selected, any forms associated with that type of business object are presented.

Size Clause

This clause defines the page dimensions of the form. This is commonly equal to standard page sizes such as 8½ by 11 inches or 8½ by 14 inches. However, you are not restricted to these sizes.

A page is a logical unit that you define. Once defined, the definition determines where to place the header, footer, and margins. But, you must define the page size to determine when one page ends and another begins.

To define a page size, you need two numeric values. One represents the width and one represents the height. Both of these values must be provided and entered according to the following syntax:

add form size WIDTH HEIGHT

If you wanted the dimensions of a standard page, you would write one of the following clauses. The clause you use depends on the units you specified in the Units clause.

Size ClauseStandard Page
size 80 66 Measured in picas.
size 612 792 Measured in points.
size 8.5 11 Measured in inches.

Field Clause

The Field clause specifies the values to be printed and their general placement on the page:

add form field FIELD_TYPE FIELD_DEF

  • FIELD_TYPE identifies the general function of the field value being defined. All Field clauses must include a Field Type subclause which must be given before any defining subclauses. When specified, the field type identifies the kind of value that will be printed:
    Field Type Specifies
    label STRING_VALUE A printable string of characters used for headers, column headings, and separators. For example, a form title or footnote would use the Label field type.
    select QUERY_WHERE_EXPR Any selectable business object value. This allows for information to be retrieved from related objects as well as from the object to which the form is attached. Enter an expression that should appear on the form.

    The expression is constructed according to the syntax described in Where Clause. Unlike a QUERY_EXPR expression that must produce a true or false value, the QUERY_WHERE_EXPRESSION can produce any type of value. This means that you can use the name of a field that contains a non-Boolean value in the field type definition. For example, each of the following are valid Expression subclauses that define a field type value:

    expression DESCRIPTION
    expression attribute "All tests are negative" 
    expression '"attribute[Base Cost]" <= 
      "attribute[Maximum Cost]"
     expression 'Blood_Test_Positive or EKG_Positive'

    In the first example, the Description field value (a character string value) is used. In the second example, the value of the attribute "All tests are negative" (a Boolean value) is printed. In the third and fourth examples, the values of the relational and Boolean expressions are used for the form output. For more information, see MQL Concepts: Manipulating Data.

    businessobject QUERY_EXPRA business object selected by the query expression. For more information, see Where Clause.
    relationship QUERY_EXPRA relationship selected by the query expression. For more information, see Where Clause.
    edit [false | true]Defines the field as editable (true) or view-only (false).
    multiline [false | true]Defines the field as multiline (true) or single line (false).
    graphic IMAGE_PATH An imported graphical image, such as a logo or scanned image. Enter the directory path for the graphic file. This is the same image no matter what object is selected.
    imageDefines the field as containing an image.
    icon The icon of the form.
  • FIELD_DEF (field definition) is a subclause that provides additional information about the value to be printed. These subclauses define information such as where the values should be placed on the page, how often the field values should be printed, and test criteria to ensure that you have the correct values.
Field Definition Specifies
setting NAME VALUE For use in Web forms only. Settings are general name/value pairs that can be added to a field as necessary. They can be used by JSP code, but not by hrefs on the Link tab.
user USER_NAME | all For use in Web forms only to specify who will be allowed access to the field.
alt ALT_VALUE For use in Web forms only to display alternate text until any image associated with the command is displayed and also as "mouse over text."
autoheight [false|true] When set to true, the height of the field will adjust to the amount of information displayed.
autowidth [false|true] When set to true, the width of the field will adjust to the amount of information displayed.
businessobject EXPRESSION Computable expression pertaining to business objects.
color [FOREGROUND] [on BACKGROUND] The color of the form foreground (printed information) and background.
drawborder [false|true] Draws a border around the output field.
edit true | false Is field editable?
font FONT_NAME The name of a system font that a field displaying text will use.
[!]hidden Is field hidden or not (!) hidden.
href HREF_VALUE Provides link data to the JSP.
label LABEL Field label
minsize MIN_WIDTH MIN_HEIGHT The minimum width and/or height of the field.

The mechanism used for rendering fonts on the Web differs from the one that is used for the Studio Modeling Platform. Therefore, forms that are intended for use in both environments need to be designed to accommodate these slight differences. Increasing the size of the field will fix the problem.

multiline true | false Is field multiline?
name NAME Field name
order NUMBER For use in Web forms only to re-order field items. When the order number of a field is set to a number less than 0, a warning is issued and the field is placed before all other fields. If you print a form from the database that has fields with negative order numbers, you will also receive a warning.
range RANGE_HELP_HREF_VALUE For use in Web forms only to specify the JSP that gets a range of values and populates the field with the selected value. These values can be displayed in a popup window or a combo box.
relationship EXPRESSION Computable expression pertaining to relationships.
remove setting NAME VALUE For use in Web forms only to remove settings.
remove user USER_NAME | all For use in Web forms only to specify who will not be allowed access to the field.
resizeheight [false|true] Permits the resizing of the height value for variable sized display fields.
resizewidth [false|true] Permits the resizing of the width value for variable sized display fields
scale PERCENTAGE_VALUE The percentage to scale the form.
select EXPRESSION Select clause
size WIDTH HEIGHT The width and height size of the field.
start XSTART YSTART The X and Y coordinates of the field's starting point. This is where the first character of the field value is printed. Refer also to the description of Field Starting Point below.
update UPDATE_URL_VALUE For use in Web forms only to specify the URL page that should be displayed after the field is updated.

Field Starting Point

The field’s starting point can be specified in one of two ways. The first is to give the absolute X and Y coordinates. The second is to give the X and Y coordinates relative to the form’s header and left margin.

Absolute coordinates begin with 1,1 and are measured from the upper left corner of the page. They use the syntax:

@X_START_VALUE @Y_START_VALUE

  • @ indicates that the coordinates are absolute.
  • X_START_VALUE specifies the distance across.
  • Y_START_VALUE specifies the distance down.

For example, you could write the following field description to place a title at the top of the form:

field label "Daily Customer Form For:"
   start @10 @5 size 28 1

This description will start printing the title string “Daily Customer Form For:” in the upper left corner of the page. Its coordinates, given in picas, indicate ten characters over and five lines down from the uppermost left corner of the page. Take care to ensure that field sizes do not conflict with other field locations.

Relative coordinates can begin with 0,0 and are specified in the same general manner as absolute coordinates:

X_START_VALUE Y_START_VALUE

  • X_START_VALUE specifies the distance across.
  • Y_START_VALUE specifies the distance down.

However, with relative coordinates, the values are measured from the upper left corner of the header and left margin intersection. For example, assume you have a form with a header of 6 and a left margin of 11. To place the same title in the same place as in the previous example, you would write the following field definition:

field string "Daily Customer Form For:" start 0 0 size 28 1

While the starting point is given as (0,0), this actually translates to an absolute starting point of (11,6). That is because the starting point for all relative coordinates is the bottom of the header (the 6th line) and the end of the left margin (11th character). When specifying the relative coordinates, you will always have to add the header and left margin values to obtain the absolute coordinates. Therefore a relative position of (28,0) translates into an absolute position of (39,6).

When specifying the starting point, you can use any combination of relative or absolute values. Absolute coordinates are useful when you want to print a title within the heading, footer, or margin areas. You cannot do this using relative coordinates.

Centering the title on the page is done by using the starting point in conjunction with the Size subclause. The Size subclause specifies the width and height of the field. First determine the number of characters required to print the title (36 characters) and then determine the amount of space remaining (80 - 36 = 44). That amount is divided in half to determine the starting row for the first field (@22). If you add the field size to this starting value, you find the starting location for the second field (@49).

Like the Start clause of the Add Form command, the size is given width first and height second. For example, a value of “Address: ” is nine pica characters long and uses one line. Therefore, its size could be expressed as:

size 9 1

All geometry subclauses must include the field size. If the size value is larger than the field value, the field value is padded with blank spaces so that the field and size values are equivalent. If the size value is smaller than the field value, the field value is truncated on the right to fit into the field size. Multiple-line text output will wrap at word boundaries if the form field contains more than one output line.

History Clause

The history keyword adds a history record marked “custom” to the form that is being added. The STRING argument is a free-text string that allows you to enter some information describing the nature of the addition. For more information, see Adding History to Administrative Objects.

Copy Form

After a form is defined, you can clone the definition with the copy form command.

Syntax

After a form is defined, you can clone the definition with the Copy Form command. This command lets you duplicate defining clauses with the option to change the value of clause arguments.

copy form FROM_NAME TO_NAME [MOD_ITEM {MOD_ITEM}];
  • FROM_NAME is the name of the form definition (source) to copied.
  • TO_NAME is the name of the new definition (destination).
  • MOD_ITEMs are modifications that you can make to the new definition. For more information, see Modify Form.

History Clause

The history keyword adds a history record marked “custom” to the form that is being copied. The STRING argument is a free-text string that allows you to enter some information describing the nature of the copy operation. For more information, see Adding History to Administrative Objects.

Modify Form

After a form is defined, you can change the definition with the Modify Form command. This command lets you add or remove defining clauses and change the value of clause arguments.

modify form NAME [MOD_ITEM {MOD_ITEM}];
  • NAME is the name of the form you want to modify.
  • MOD_ITEM is the type of modification you want to make. Each is specified in a Modify Form clause, as listed in the following table. You only need to specify fields to be modified.
    Modify Form Clause Specifies
    ADD_ITEMAdds the specified item. For more information, see Add Form.
    units [picas|points|inches] The current units of measurement is changed to the new units entered.
    description VALUE The current description value, if any, is set to the value entered.
    icon FILENAME The image is changed to the new image in the file specified.
    add rule NAME The named rule is added.
    remove rule NAME The named rule is removed.
    color [FOREGROUND] [on BACKGROUND] The foreground and/or background colors are changed to the new values entered.
    header HEADER_SIZE The current header, if any, is set to the value entered.
    footer FOOTER_SIZE The current footer, if any, is set to the value entered
    margins LEFT_MARGIN RIGHT_MARGIN The left and/or right margins are changed to the new values entered.
    type TYPE_NAME {,TYPE_NAME] The type(s) associated with the form is changed to the type(s) entered.
    type delete TYPE_NAME {,TYPE_NAME} The type identified by the type name is removed from the form.
    size WIDTH HEIGHT The current page size is set to the new values given
    field delete FIELD_NUMBER The field identified by the given field number is removed from the form. To obtain the field number for a specific field, use the Print Form command. When the form definition is listed, specify the number assigned to the field to delete.
    field modify FIELD_NUMBER FIELD_DEF FIELD_TYPE FIELD_DEF A field is modified (according to the field definition clauses) and placed at the end of the field list
    hidden The hidden option is changed to specify that the object is hidden.
    nothidden The hidden option is changed to specify that the object is not hidden.
    property NAME [to ADMINTYPE NAME] [value STRING] The named property is modified.
    add property NAME [to ADMINTYPE NAME] [value STRING] The named property is added.
    remove property NAME [to ADMINTYPE NAME] [value STRING] The named property is removed.
    web Sets the form as a web form used in HTML/JSP applications.
    [!|not] web Sets the form for use in the Studio Modeling Platform.
    history STRING The history keyword adds a history record marked "custom" to the form that is being modified. The STRING argument is a free-text string that allows you to enter some information describing the nature of the modification. For more information, see Adding History to Administrative Objects.

Each modification clause is related to the arguments that define the form. To change the value of one of the defining clauses or add a new one, use the Modify clause that corresponds to the desired change. For example, use the Size clause of the Modify Form command to alter the values of the Size clause used in the Add Form command. The only exception to this general rule involves modifying field definitions.

When modifying field definitions within an existing form, you have only two choices. You can either remove an existing field definition or you can add a new one. The Modify Form clause does not offer a way to alter the subclause values that make up a field definition. Therefore, if you are unhappy with a subclause value, you can only remove the entire field definition and replace it with one that has the desired changes in it.

New field definitions appear at the end of the form definition. While they are listed last, their placement in the form definition does not affect the placement of the form values. That is controlled by the geography and size values within the field definitions themselves.

Delete Form

If a form is no longer required, you can delete it using the Delete Form command.

delete form NAME;
  • NAME is the name of the form to be deleted.

Searches the list of defined forms. If the name is found, that form is deleted If the name is not found, you an error message is displayed. For example, to delete the form named “Income Tax Form,” enter the following:

delete form "Income Tax Form";

After this command is processed, the form is deleted and you receive an MQL prompt for another command.

Print Form

Use the Print Form command to print information about the attributes of a specific form, including the number and characteristics of each form field.

print form NAME [SELECT];
  • NAME is the name of the form to be printed.
  • SELECT specifies a subset of the list contents. For more information see the Appendix: Selectables.

Searches the list of defined forms. If the name is found, that form information is printed. If the name is not found, an error message is displayed. For example, to print details about the form named “TechTip,” enter the following:

print form "TechTip";

The following is sample output:

MQL<28>print form 'TechTip';
Form           TechTip
 inactive 

field# 1       label Notes:
    font         Times New Roman-bold-12
    autoheight   false
    autowidth    false
    drawborder   false
    hidden       false
    start        2 54
    size         13 2
    user         all

field# 2       select attribute[Notes]
    color        black on lemon chiffon
    font         Times New Roman-10
    autoheight   false
    autowidth    false
    drawborder   true
    multiline    true
    edit         true
    hidden       false
    start        23 54
    size         75 5
    user         all

field# 3       label Reason:
    font         Times New Roman-bold-12
    autoheight   false
    autowidth    false
    drawborder   false
    hidden       false
    start        2 44
    size         20 2
    user         all 
 
field# 4       select "attribute[Reason]"
    color         on lemon chiffon
    font         Times New Roman-10
    autoheight   false
    autowidth    false
    drawborder   true
    multiline    true
    edit         true
    hidden       false
    start        22 44
    size         75 8
    user         all  

field# 5       select description
    color         on lemon chiffon
    font         Terminal-10
    autoheight   false
    autowidth    false
    drawborder   true
    multiline    true
    edit         true
    hidden       false
    start        22 23
    size         75 19
    user         all
    nothidden
  created Fri Jun 22, 2001 8:16:45 PM EDT
  modified Fri Jun 22, 2001 8:16:45 PM EDT  nothidden
  created Wed Oct 31, 2001 2:57:09 PM EST
  modified Wed Feb 20, 2002 2:47:56 PM EST

Since forms have additional uses in support of dynamic UI modeling, the MQL print command suppresses the output of data that is not used. For example, if you print a form that is defined as a system object used for Web applications, the following selects will not be printed:

size, minsize, scale, font, minwidth, minheight, absolutex, absolutey, xlocation, ylocation, width, and height.

Conversely, when printing non-Web forms, parameters used only for Web forms are suppressed from the output:

href, alt, range, update, and settings