AESection Class Methods

In this section, we discuss each AESection class method, in alphabetical order.

Syntax

AddStep(ae_step_name [, NewStepName])

Description

The given step name from the template section is added as the next step into the base section, and named the existing step name.

Note: When you open or get a section, all the existing steps are deleted. The first time you execute AddStep, you add the first step. The second time you execute AddStep, you add the second step, and so on.

All attributes of the step are copied, including all of its actions. The only changeable attribute of a step are its SQL statements, which can be modified using the SetSQL method. SetSQL is run on the current step, that is, the step most recently added.

You can also change the name of the step by using the optional parameter NewStepName.

If the step named does not exist in the template, an error occurs. Likewise, if you have not opened or set the template for the section, you receive an error.

Parameters

Field or Control

Definition

ae_step_name

Specify the step name from the template to be added as the next step in the base section. This parameter takes a string value.

NewStepName

Specify a new name for the step to be added. This parameter is optional, and takes a string value.

Returns

None.

Example

See AESection Example.

Syntax

Close()

Description

Close closes the AESection object. Any unsaved changes to the section are discarded.

Parameters

None.

Returns

None.

Example

See AESection Example.

Syntax

Open(ae_applid, ae_section, [effdt])

Description

The Open method associates the AESection object with the given Application Engine section, based on the ae_applid and ae_section. If the effdt is specified, this is also used to get the section object. In other words, the Open method sets the base section.

Warning! When you open or get an AESection object, (that is, the base section) any existing steps in the section are deleted.

Note: If the base section you specify doesn’t exist, a new base section is created. This enables you to dynamically create sections as needed. In addition, if the target section doesn't exist, all section-level attributes are copied from the template to the target section. If the target exists, it retains its attribute settings.

If the AESection is still open when you issue the Open method, the previously opened object is discarded and none of the changes saved. To prevent accidentally discarding your changes, you can use the IsOpen property to verify if a section is already open.

The AESection is open based on the Market and database type of your current system.

Parameters

Field or Control

Definition

ae_applid

Specify the application ID of the section you want to access. This parameter takes a string value.

ae_section

Specify the section name of the section you want to access. This parameter takes a string value.

effdt

Specify the effective date of the section you want to access (optional). This parameter takes a string value.

Returns

An AESection object.

Example

Local AESection &SECTION;
&SECTION = GetAESection("RULES1", "DYN_SECT");
/* do some processing */
&SECTION.Close();
&SECTION.Open("RULES2", "DYN_SECT");
/* do additional processing */

Syntax

Save()

Description

The Save method saves the section to the database. The AESection object remains open after you use this method. To close the object, you must use the Close method.

You must commit all database changes prior to using this method. This is to avoid locking critical Tools tables and hence freezing all other users. You receive a runtime error message if you try to use this method when there are pending database updates, and your PeopleCode program terminates. You need to commit any database updates prior to using this method. Use the CommitWork function to commit database updates.

Parameters

None.

Returns

None.

Example

See AESection Example.

Syntax

SetSQL(action_type_string, string)

Description

The SetSQL method replaces the SQL associated with the given action type in the current step in the base section with the SQL in string. The current step is the latest step that was added using AddStep. The action types are:

  • DO_WHEN

  • DO_WHILE

  • DO_SELECT

  • SQL

  • DO_UNTIL

Note: All action types must be passed in as strings with quotation marks.

If the action specified does not exist in the current step, an error occurs.

You can use a SQL object as string.

&SECTION.SetSQL("SQL", &SQL);

Parameters

Field or Control

Definition

action_type

Specifies the action type of the current step that should be changed. This parameter takes a string value.

string

Specifies the SQL to be used to replace the SQL in the current step.

Returns

None.

Example

See AESection Example.

Syntax

SetTemplate(ae_applid, ae_section)

Description

The SetTemplate method sets the template to be used with an AESection object, as identified by ae_applid and ae_section.

The rules for assigning a template section are similar to the rules for selecting a base section. The selection of market and database platform are done exactly the same. However, the effective date of the template is always set based on the effective date of ‘1900-01-01’.

You must set the template before you can use any of the other methods.

Parameters

Field or Control

Definition

ae_applid

Specify the name of the Application Engine program that contains the section to be used as the template.

ae_section

Specify the name of the Application Engine section in the program to be used as the section template.

Returns

None.

Example

See AESection Example.