AESection Example
Assume that you have a template section called TEMPLATE in the Application Engine program called MY_APPL. The template looks like this:
| 
 Steps  | 
 Actions  | 
|---|---|
| 
 NewStep1  | 
 DO When DO Select SQL  | 
| 
 NewStep2  | 
 DO Select CallSection  | 
Also, assume that you have a base section called DYN_SECT in the Application Engine program called RULES. When you start, this section looks like this:
| 
 Steps  | 
 Actions  | 
|---|---|
| 
 Step1  | 
 DO Select Call Section DO Unit  | 
| 
 Step2  | 
 Call Section  | 
Here’s the PeopleCode:
Local AESection &Section;
&Section = GetAESection("RULES", "DYN_SECT"); 
/* Open the base section */
&Section.SetTemplate("MY_APPL", "TEMPLATE");    
/* Set the template section */
&Section.AddStep("NewStep2");                      
/* Insert NewStep2     */
/* Do some SQL stuff here  */
&Section.SetSQL("DO_SELECT", &MySql);    
/* Modify the SQL in the added step */
&Section.Save();
&Section.Close();                               
/* Save and close   */
The base section looks like this after execution:
| 
 Steps  | 
 Actions  | 
|---|---|
| 
 NewStep2  | 
 DO Select Call Section  | 
Note: The existing steps in the base section have been overwritten by the new step from the template section.