HaveSection

HaveSection

Use this function to determine if a given section is contained in the document.

Note HaveSection replaced HaveImage. HaveImage and HaveSection have the same functionality; the only change is to the function name. Existing scripts using HaveImage will continue to function and will not require any modification.

Syntax

HaveSection (Section, Form, Group)

Parameter

Description

Section

The name of a section to locate. The default is the current section.

Form

The name of a form that is assumed to contain the specified section. The default is the current form.

Group

The name of a group containing the specified section or form. The default is the current group.

The system returns one (1) if the section is located and zero (0) if it cannot be found.

You can omit all the parameters; however doing so will typically return 1, since the current section will be located and satisfy the search.

As mentioned earlier, omitting a parameter will default to whatever is considered the current object for that level. So if you specify the section name, but omit the form and group names, then those two parameters will default to searching for the section within the current form within the current group.

Names of objects are not case sensitive, but do have to match. Partial matches are not supported. This means if you have a section named “ABC_10”, passing the partial name “ABC” will not match on that item.

A single asterisk “*” can be used as a wildcard to match on any object for that parameter. For example: If you don’t know the form name that might contain a particular section, then you could specify an asterisk (as a quoted string) as the object name to match on any form.

Note Using a wildcard will broaden the search criteria, but could affect your performance as the document size increases.

If the section or form you are seeking possibly occurs multiple times within your document set, you can specify an occurrence value to limit the search to a particular instance.

For instance, if there are three occurrences of a given section on a particular form, you would distinguish them as ITEM\1, ITEM\2, and ITEM\3.

The backslash (\) is not a valid character in any object name. When found, the object functions assume that the number following the backslash identifies the particular occurrence of that named object you are requesting

Examples

Here are some examples:

Function

Result

Explanation

HaveSection( "IMG")

1 or 0

Attempts to locate the named section on the current form. If found, return 1.

HaveSection("IMG\2", "Form\3", "GRP")

1 or 0

Locate the third occurrence of Form within the specified group. If found, then locate the second occurrence of IMG. If successful, return 1.

HaveSection("IMG", "*") 1 or 0 Locates the section IMG on any form within the current group. If successful, return 1. Note that the wildcard “*” specified as the form name will match on any form name where omitting the parameter would only have searched the current form.

For these next examples, assume you have two forms with the same names in the document set, but a different list of sections contained within each.

FormA = X_Section, Z_Section

FormA = A_Section, Z_Section

 

Function

Result

Explanation

HaveSection("A_Section","FormA") 1 The result is 1 because you DO have a section named “A_Section” on a form named “FormA”. This statement did not identify to limit the search to a particular form, therefore HaveSection looked for any match of the criteria provided.
HaveSection("A_Section","FormA\1") 0 This statement specifically asks if there is section named “A_Section” on the first occurrence of form named “FormA”. There is not.
HaveSection("A_Section","FormA\2") 1 This statement specifically asks if there is section named “A_Section” on the second occurrence of form named “FormA”. There is.

See also