Cicode Programming Reference > Cicode Function Categories > Device Functions Introduction > DevFind

DevFind

Searches a device for a record that contains specified data in a specified field. The search starts at the current record and continues forward until the matched data is found or the end of the database is reached. If the file has a keyed index, an indexed search is used.

Syntax

DevFind(hDev, sFind, sField)

hDev:

The device handle, returned from the DevOpen() function. The device handle identifies the table where all data on the associated device is stored.

sFind:

The data to find in sField, as a string.

For SQL devices: The DevFind() function can distinguish between numbers, strings, and dates, so you do not need to enclose the data in quote marks. Dates and times need to be in the correct format:

sField:

The field name to match.

Return Value

0 (zero) if successful, otherwise an error is returned.

Related Functions

DevOpen, DevSeek

Example

! Find the Ice cream recipe.
DevNotFount=DevFind(hDev,"Ice cream","Recipe");
IF DevNotFount=0 THEN
! Get the recipe values.
..
ELSE
Prompt("Ice cream not found");
END

See Also

Device Functions