Product Logo

CNS Query

Query your databases without relationships.

Functions

CNSQuery_GetFieldValueByFind

NameCNSQuery_GetFieldValueByFind
Description

This function retrieves the Value of a single Field using Find Criteria. The first parameter is the Name of a Table Occurrence of the Table to Get the Field Value from. If you do not specify this parameter, CNS Query will use Get(LayoutTableName) to get the Current Layout TO to Get the Field Value from. The second parameter is the Name of the Field to retrieve. The third parameter is a return- or paragraph mark-separated list of “FieldName=FieldValue” pairs that describes the Criteria for Finding the Record to Get the Field Value from. See the “Finding What You Want” section in the CNSQuery_FindRecords function for help in defining your Find Criteria. By default, CNS Query will check to make sure the TO Name and all the Field Names you specify exist before attempting to Get the Field Value. If you already know for sure that the TO Name and the Field Names exist, you can pass True as the fourth and fifth parameters. Finally, if you want the Find to be Case Sensitive, you can specify True as the last parameter.

Return TypeVaries
FormatCNSQuery_GetFieldValueByFind ( TOName ; FieldName ; FindCriteria ; SkipTONameCheck ; SkipFieldNameChecks ; CaseSensitive )
Required Parameters
TOName

The Name of a Table Occurrence of the Table to Get the Field Value from. Specify “” to use the Current Layout TO. In FileMaker Pro 11 and above, you can optionally specify the Database Filename (without the “.fp7” extension) containing the TO in the format “FileName.TOName”.

FieldName

The Name of the Field to retrieve the Value from.

FindCriteria

A return- or paragraph mark-separated list of “FieldName=FieldValue” pairs describing the Criteria for Finding the Record to get the Field Value from. See the “Finding What You Want” section of the CNSQuery_FindRecords function for help in setting up the Find Criteria.

Optional Parameters
SkipTONameCheck

If True, CNS Query will not check to make sure the TO Name you specified actually exists before retrieving the Field Value.

SkipFieldNameChecks

If True, CNS Query will not check to make sure all the Field Names in the various parameters actually exist before retrieving the Field Value.

CaseSensitive

If True, CNS Query will preserve the Case in the Field Values of the Find Criteria. (In other words, if CaseSensitive is True, “Green” would not match “green”.)

Examples
Example 1

This would retrieve the Value of the "BField" Field from the "MyTable" Table from the Record where the "AField" Field has the Value "some value".

CNSQuery_GetFieldValueByFind( "MyTable" ; "BField" ; "AField=some value" )
Example 2

This would retrieve the Value of the "LastName" Field from the current Table from the Record where the "FirstName" Field has the value "Ann".

CNSQuery_GetFieldValueByFind( "" ; "LastName" ; "FirstName=Ann" )
Example 3

In FileMaker Pro 11 and above, use this form to get the Field Value from a Table Occurrence in a separate, open Database file.

CNSQuery_GetFieldValueByFind( "AnotherFile.MyTable" ; "BField" ; "AField=some value" )