10.07.2015 Views

Programming Guide - Actian

Programming Guide - Actian

Programming Guide - Actian

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

How You Can Manipulate Data in Dynamic FieldsHow You Can Populate a Dynamic Table FieldTo populate a dynamic table field from a database table, use an SQLSelectobject or a QueryObject object and point the target array of the query objectto the array you declared for the table field.For example, the DynamicQuery frame uses a query object to load adynamically created table field at runtime. The code in this frame thatretrieves the data from the database and displays it in a table field performsthe following operations:• Declares an array variable called tarray• Establishes the values in the tarray array as:– The array underlying the tbl table field– The query object's TargetArray• Opens a query object named qo in array mode, retrieving the data fromthe database• Closes the query object• Updates the form display, forcing display of data in tblThe following code performs these operations:declaretarray = ArrayObject;enddeclare...qo.TargetArray = tarray;. . .tfield.DeclareData(result = byref(tarray));...status = qo.Open(QueryMode = QY_ARRAY);qo.Close();field(tbl).UpdField();Opening a query object in QY_ARRAY mode retrieves all the data directly fromthe database into the named array during the Open method invocation. (TheLoad and NextRow methods are not required to display the data on the form.)Because array mode eliminates intermediate steps in retrieving and displayingdata, performance is better using array mode rather than cache, cursor, ordirect modes.For array mode, the class of the array being loaded must have attribute namesmatching the names of the columns in the query (the array attributes mustmatch all columns whose IsSelectTarget attribute has been set to TRUE).For more information about using SQLSelect and QueryObject objects, seeWorking with a Database (see page 147).384 <strong>Programming</strong> <strong>Guide</strong>

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

Saved successfully!

Ooh no, something went wrong!