10.07.2015 Views

Programming Guide - Actian

Programming Guide - Actian

Programming Guide - Actian

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

How You Can Create and Modify Fields DynamicallyHow You Can Add a Column to a Table FieldYou can add a column to an existing table field using the following steps.1. Create a form field to serve as the prototype field for the column.Table fields are typically composed of entry fields, but the prototype canbe any form field.The following code instantiates an entry field object as a member of anarray named efields:efields[j] = EntryField.Create();2. Assign appropriate attributes to the field.You must give the field a name. If you do not supply a data type for anentry field, OpenROAD provides a default of varchar(100).The following example sets attributes for an entry field to contain dates:efields = EntryField.Create();colname = 'some_string';efields.Name = colname;efields.DataType = 'date';efields.FormatString = 'd"2/3/01"';3. Insert the field into the table field, for example:field(tfield).InsertColumn(fieldtoinsert = efields[j], position = j, title =colname);If position is not specified, the column is inserted as the first column of thetable field. The mandatory title parameter specifies the text for thatcolumn's title.Inserting a field into a table field creates a ColumnField. The referencevariable pointing to the column field is stored in thetblfld.TableBody.ChildFields array.4. To change other attributes of the column's title, such as type size,reference the TitleTrim attribute of the ColumnField.The following code changes the column's font style and size:ColumnField(tfield.TableBody.ChildFields[j]).TitleTrim.IsBold = TRUE;ColumnField(tfield.TableBody.ChildFields[j]).TitleTrim.TypeSize = 10;You must cast a TableBody's child field to a ColumnField. For moreinformation about casting, see How You Can Work with Attributes (seepage 140).Creating Dynamic Frames 377

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!