01.06.2013 Views

OpenEdge Development: Mobile Applications - Product ...

OpenEdge Development: Mobile Applications - Product ...

OpenEdge Development: Mobile Applications - Product ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

find( ) method<br />

find( ) method<br />

Searches for a record in a temp-table referenced in JSDO local storage and returns a<br />

reference to that record if found. If no record is found, it returns null.<br />

After completing execution, any record found becomes the working record for the<br />

associated temp-table. If the searched temp-table has child temp-tables, and the<br />

useRelationships property is true, the working record of the result set for each child<br />

is set to the first record as determined by the relationship to its respective parent. If a<br />

record is not found, the working record is not set, and the working records of any child<br />

temp-tables are also not set.<br />

Return type: JSRecord object<br />

Applies to: progress.data.JSDO class, table reference property (JSDO)<br />

Syntax<br />

[table-ref.]find ( funcRef )<br />

table-ref<br />

funcRef<br />

A table reference on the JSDO. If the JSDO references only a single temp-table,<br />

the method can be called on the JSDO itself.<br />

A reference to a JavaScript function that returns a Boolean value and has the<br />

following signature:<br />

Syntax<br />

function [ func-name ] ( jsrecord-ref )<br />

Where func-name is the name of a function that you define external to the<br />

find( ) parameter list and jsrecord-ref is a JSRecord reference to the next<br />

available record on table-ref. You can also define funcRef without func-name<br />

directly as an in-line function definition.<br />

The find( ) function executes your funcRef for each record of table-ref, until<br />

it returns true, indicating that funcRef has found the record. You can test the field<br />

values on the data property of jsrecord-ref to determine the result. Otherwise,<br />

you return false, and the find( ) function executes funcRef for the next<br />

available record.<br />

If funcRef finds the record, find( ) completes execution with both its return value and<br />

the record property of table-ref set to the JSRecord reference of the found working<br />

record. If find( ) reaches the end of available records without funcRef returning<br />

true, find( ) completes execution with both its return value and the record property<br />

on table-ref set to null, indicating that the sought for record is not found.<br />

If table-ref references a child temp-table in a ProDataSet, when the<br />

useRelationships property is true, find( ) uses the relationship to filter out all but<br />

the child records of the working record in the parent temp-table. However, if the working<br />

record of the parent is not set, find( ) throws an error. If useRelationships is false,<br />

the search includes all records of the child temp-table and no error is thrown.<br />

210 <strong>OpenEdge</strong> ® <strong>Development</strong>: <strong>Mobile</strong> <strong>Applications</strong>

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

Saved successfully!

Ooh no, something went wrong!