Product Logo

CNS Query

Query your databases without relationships.

Functions

CNSQuery_UpdateRecordByFind

NameCNSQuery_UpdateRecordByFind
Description

This function Updates one or more Records based on Find Criteria. The first parameter is the Name of a Table Occurrence of the Table to Update the Record in. If you do not specify this parameter, CNS Query will use Get(LayoutTableName) to get the Current Layout TO to Update the Record in. The second parameter is a return- or paragraph mark-separated list of “FieldName=”FieldValue“ pairs describing the Criteria for Finding the Record or Records to Update. See the ”Finding What You Want“ section of the CNSQuery_FindRecords function for help in defining your Find Criteria. The third parameter is a return- or paragraph mark-separated list of ”FieldName=FieldValue“ pairs describing the Field Values to Update the Record with. If a Field Value needs a return in it, you can use ”<CR>" to indicate a return. By default, CNS Query will only Update the first Record it finds. If you want to Update all Records that match the Find Criteria, specify True as the fourth parameter. By default, CNS Query will check to make sure the TO Name and all the Field Names exist before attempting to Update the Record. 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_UpdateRecordByFind ( TOName ; FindCriteria ; FieldValues ; UpdateAllMatches ; SkipTONameCheck ; SkipFieldNameChecks ; CaseSensitive )
Required Parameters
TOName

The Name of a Table Occurrence of the Table that contains the Record you want to Update. 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”.

FindCriteria

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

FieldValues

A return- or paragraph mark-separated list of “FieldName=FieldValue” pairs describing the new Field Values to Update the Record with. Use “<CR>” to indicate a return or new line in a Field Value.

Optional Parameters
UpdateAllMatches

If True, CNS Query will Update all Records that match the Find Criteria. Default is False.

SkipTONameCheck

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

SkipFieldNameChecks

If True, CNS Query will not check to make sure all the Field Names you specified in the various parameters actually exist before Updating the Record.

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

Updates the first Record in the "MyTable" Table where the "AField" Field has the Value "some value", setting the "BField" Field to "some new value" and the "CField" Field to "some other value".

CNSQuery_UpdateRecordByFind( "MyTable" ; "AField=some value" ; "BField=some new value¶CField=some other value" )
Example 2

Updates all Records in the current Table where the "State" Field has the value "Texas", setting the "Region" Field to the Value "South".

CNSQuery_UpdateRecordByFind( "" ; "State=Texas" ; "Region=South" ; True )
Example 3

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

CNSQuery_UpdateRecordByFind( "AnotherFile.MyTable" ; "AField=some value" ; "BField=some new vlaue")