AddForm

Use this function to add a new form to a document. Optionally, this function returns 1 on success or 0 on failure.

Syntax

AddForm (Form, Insert, Group,source key2, source key1)

Parameter

Description

Defaults to..

Form Name

Name of a valid form in the specified group.

Not required, but there is no default

insert name

The name of an existing form to insert the new form after.

.

By default will append after the last form in the group.

Group

Name of a group to contain the specified form

.

Defaults to current group
source key2 Name of a different group (key2) that contains the requested form. Defaults to the group used by the previous parameter
source key1 Name of a key1 classification from the FORM.DAT that contains the requested form. Defaults to the key1 classification used by the “group” parameter

Add a new copy of the specified form to the document set. The insert (form) name may be specified using the occurrence indicator and identifies the insertion position to use for the new form within the document set.

If the group parameter is given, it must reference a valid group already included in the form set. When the group parameter is omitted, it will default to the current group that contains the DAL script being executed. You cannot add a group or add forms to a group that was not specified during form selection.

Example

Here are some examples:

Procedure

Result

Explanation

AddForm( "Form1")

1 or 0

Add the named form after the last form in the current group.

AddForm( "Form", "Form\1", GRP")

1 or 0

Insert the named form after the first occurrence of that form within the named group.

Note Generally, your forms are grouped for a reason. Consider carefully when deciding to take a form defined within one group and add it via DAL ADDFORM into a different group

The final two optional parameters provide an ability to add a form from a forms list (group) file that may not be part of your current document set.

Notice that although you typically refer to forms list groupings named as Key1+Key2, these final two parameters are actually specified in reverse. The source key2 value is specified first to allow the final source key1 parameter to be omitted when it should default to the same Key1 already associated with the transaction. Including the source key1 parameter at the end indicates the desired form may be specified within a different Key1+Key2 combination that what is associated with current transaction document.

When the source key1 and / or source key2 parameters are specified, that forms list grouping will be loaded (if necessary) and the requested form located using these parameters. Any form added from this forms list will be added to a group that is already part of the document set. No new groups will be added to the existing document set.

Function

Result

Explanation

ADDFORM(“Form”, , , ,”Key2”)

)

1 or 0

Add the named form after the last form in the current group. The named form is defined with the Key2 grouping identified and assumed part of the same Key1 grouping already defined by the transaction. This Key2 grouping may or may not be part of the current document set.

ADDFORM(“Form”, , , ,”Key2”, “Key1”)

)

1 or 0

Add the named form after the last form in the current group. The named form is defined with the Key1, Key2 grouping identified by the last two parameters, which may not be part of the current document set.

See also