Product Logo

CNS Query

Query your databases without relationships.

Functions

CNSQuery_SetFieldValueByFind

NameCNSQuery_SetFieldValueByFind
Description

This function Sets the Value of a single Field using Find Criteria. The first parameter is the Name of a Table Occurrence of the Table to Set the Field Value in. If you do not specify this parameter, CNS Query will use Get(LayoutTableName) to get the Current Layout TO to Set the Field Value in. The second parameter is the Name of the Field to set. The third parameter is the new Value for the Field. The fourth parameter is a return- or paragraph mark-separated list of “FieldName=FieldValue” pairs that describes the Criteria for Finding the Record to Set the Field Value in. 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 Set the Field Value. If you already know for sure that the TO Name and the Field Names exist, you can pass True as the fifth and sixth parameters. Finally, if you want the Find to be Case Sensitive, you can specify True as the last parameter.

Return TypeText
FormatCNSQuery_SetFieldValueByFind ( TOName ; FieldName ; FieldValue ; FindCriteria ; SkipTONameCheck ; SkipFieldNameChecks ; CaseSensitive )
Required Parameters
TOName

The Name of the Table Occurrence to Set the Field Value in. 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 Set.

FieldValue

The new Value for the Field.

FindCriteria

A return- or paragraph mark-separated list of “FieldName=FieldValue” pairs describing the Criteria for Finding the Record to Set the Field Value in. 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 Setting the Field Value.

SkipFieldNameChecks

If True, CNS Query will not check to make sure all the Field Names in the variaous parameters actually exist before Setting 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 Set the Value of the "BField" Field to "A New Value" in the "MyTable" Table for the first Record where the "AField" Field has the Value "some value".

CNSQuery_SetFieldValueByFind( "MyTable" ; "BField" ; "A New Value" ; "AField=some value" )
Example 2

This would Set the Value of the "LastName" Field to "Jones" in the current Table for the first Record where the "FirstName" Field has the Value "Ann".

CNSQuery_SetFieldValueByFind( "" ; "LastName" ; "Jones" ; "FirstName=Ann" )
Example 3

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

CNSQuery_SetFieldValueByFind( "AnotherFile.MyTable" ; "BField" ; "A New Value" ; "AField=some value" )