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.

Table Field OperationsThe following event block for a Control Button's Option Menu's Menu List letsusers perform this operation, determining the names of the table field andcolumn at runtime:/* Script for MENULIST */on click =declaretable_field = TableField default null;tf_array = ArrayObject default null;col_name = varchar(32) not null;sort_order = integer not null;enddeclarebegin/* Find out what table and column we are in,** if any. */if CurFrame.InputFocusField is not null thentable_field =CurFrame.InputFocusField.WhichTableField();endif;if table_field is null thenmessage 'You must be in a table field to sortit. ';resume;endif;col_name = CurFrame.InputFocusField.Name;/* Point tf_array to the array underlying** the tablefield */table_field.GetFieldValue(value = byref(tf_array));/*** Use CurEnumValue to specify sort order.** Note that the first item in the menu list** is labeled sort in ascending order, and the** second item to sort in descending order.*/if MenuList(CurFrame.TriggerField).CurEnumValue = 1then sort_order = AS_ASC;elsesort_order = AS_DESC;endif;/* Note the colon in front of col_name is required** to indicate that col_name is a variable, not the** literal column name.*/tf_array.sort(:col_name = sort_order);end;For more information about the Sort method of the ArrayObject system class,see How Sorting Arrays Works (see page 223). For information about using theWhichTableField method of the TableField system class, see WhichTableFieldMethod (see page 249).Working with Arrays, Table Fields, and Collections 253

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

Saved successfully!

Ooh no, something went wrong!