14. Creating a Frame at Runtime : How You Can Build a Frame Dynamically : How You Can Create the Script
 
Share this page                  
How You Can Create the Script
A frame's script is contained in the Script attribute of its FrameSource object. The data type of this attribute is StringObject. The first step to building a script for a frame is creating a string object and assigning it to the Script attribute of the frame's FrameSource object.
After you have created the string object, use the ConcatVarchar method to put the text into your script. This method appends text to a StringObject. The syntax of the ConcatVarchar method is:
StringObject = StringObject.ConcatVarchar(text = varchar)
The ConcatVarchar method returns a reference to the original string.
If your script includes statements that access the database, such as select or update, you can use a select statement to retrieve the necessary column names for the target lists of the statements and a select loop to build at least part of the database statements.
Alternatively, you can use a query object to create the target fields and provide the user with the ability to change the data in the database. For an example of using a query object to perform these operations, see Creating Dynamic Frames (see Creating Dynamic Frames).
The DynamicFrame frame uses a select loop to obtain information and build the target fields and a cursor object to allow the user to make changes to data in the database. For details about the implementation in the DynamicFrame frame, see How You Can Construct the Fields (see How You Can Construct the Fields) and How You Can Complete the SQL Statements (see How You Can Complete the SQL Statements).