You are here: Function Reference > Alphabetical Listing > A > ADDSection

ADDSection

ADDImage

ADDImage has been replaced with ADDSection. ADDSection and ADDImage have same functionality; the only change is to the function name. The existing ADDImage scripts will continue to function and will not require any modification.

Use this procedure/function to add a new section to a form in the current document. You can also use the Paginate parameter to specify whether form pagination should occur after the section is added. Form pagination includes the application of section origin rules to determine whether new pages are required for the pre-defined page sizes.

Syntax

ADDSection (FAP, Section, Form, Group, Flag, Paginate)

Parameter

Description

FAP

Enter the name of the section file to load and add to the form.

Section

Enter the name of a section which will precede the new section. The default is the current section.

Form

Enter the name of a form in the form set. If you specify the Section parameter, that section must occur on this form. The default is the current form.

Group

Enter the name of a group that contains the specified form. The default is the current group.

Flag

Determines if the section is inserted on the same page or on a new page.

0 - (zero) new page
1 - same page

The default is zero (0).

Paginate

(Optional) This parameter follows the Flag parameter. If you enter anything other than a zero (0), it tells the system you do want form pagination to occur upon successful inclusion of the new section.

If the section does contain an origin rule and you omit the Paginate option or set it to zero (0), the section origin rule executes upon insertion.

Whether the inserted section has an origin rule or not, the positioning of this section when the Paginate option is omitted or zero (0) does not cause the entire form to be re-paginated. This means if the placement of the section causes it to overlap another section or to be out of the page boundary, no additional re-pagination occurs. If you are manipulating multiple sections in series, you may want to conclude your script with a call to PaginateForm to make sure the entire form is re-paginated.

Here is an example:

AddSection( "myFAP", "mainImage" , , , 1,1)

This example omits the Form and Group parameters, but does specify the Flag parameter as well as the Pagination parameter.

Note: If you enter zero (0) or omit this parameter, the function works as it prior to version 11.2.

The default is zero (0).

SamePage

0= not same page. This means you want to add the section as a new page following the insertion point. If your insertion point is in the midst of a multipage section, the newly added section will be on a new page following the last page of the multipage section.

1= same page. This will attempt to add your section onto the same page with the specific insertion point section. If your insertion point is in the middle of a multipage section, the new section will only be added to the specified page if your insertion point is a header or footer - as this will make your new section of similar designation. If the insertion point is not a header or footer and you are in the midst of a multipage section, then the section will add after the last page of the multipage section.

2= force same page.

Note: It is not recommended that you forcibly insert a non-header or footer section onto the same page with a multipage section as this can generate invalid output that cannot be reloaded from disk. Do this at your own risk, and only in situations where the resulting output does not have to be subsequently reloaded for print or WIP.

The system optionally returns one (1) on success or zero (0) on failure.

This procedure adds a copy of the section you specify to a form. The system loads the new section onto the page after the section, form, or group you specified or onto a new page which it creates after the section, form, or group you specified. The section added does not have to be predefined for the form.

Note

Example

Here are some examples:

Procedure

Result

Explanation

ADDSection ("IMG1")

1 - if successfully added

0 - if not added

Insert the named section, IMG1, on a new page after the current page.

ADDSection("NEW1", "IMG\3",,"GRP")

1 - if successfully added

0 - if not added

Insert the named section, NEW1, after the third occurrence of IMG, within GRP. This section is placed on a new page after the third occurrence of the specified section.

ADDSection ("IMG1",,,, 1)

1 - if successfully added

0 - if not added.

Insert the named section, IMG1, after the current section on the same page.

ADDSection("NEW1", "IMG\3", , , 1)

1 - if successfully added

0 - if not added

Insert the named section, NEW1, after the third occurrence of IMG on the same page.

ADDSection ( “SEC\#3”,’”GRP”) 1 or 0 Locate the third logical occurrence of the SEC in the specified GRP. This differs from the above example in the case of a multi-page section – for multipage sections, the third occurrence could be the 3 page of the content for the same instance of the section. The third logical occurrence is the third instance of the multipage section within the GRP.

See also