Product Logo

CNS Query

Query your databases without relationships.

Functions

CNSQuery_AddRecord

NameCNSQuery_AddRecord
Description

This function Adds a new Record to an existing Table. The first parameter is the Name of a Table Occurrence of the Table to receive the new Record. If you do not specify this parameter, CNS Query will use Get(LayoutTableName) to get the current Table and Add the Record to that Table. The second parameter is a return- or paragraph mark-separated list of “FieldName=FieldValue” pairs describing the Field Values for the new Record. If a Field Value needs a return in it, you can use “<CR>” to indicate the return. By default, CNS Query will check to make sure the Table Name and all the Field Names you specify exist before attempting to Add the new Record. If you already know for sure that the Table Name and the Field Names exist, you can pass True as the third and fourth parameters.

Return TypeText
FormatCNSQuery_AddRecord ( TOName ; FieldValues ; SkipTONameCheck ; SkipFieldNameChecks )
Required Parameters
TOName

The Name of a Table Occurrence for the Table to receive the new Record. 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”.

FieldValues

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

Optional Parameters
SkipTONameCheck

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

SkipFieldNameChecks

If True, CNS Query will not check to make sure all the Field Names in the FieldValues parameter actually exist before attempting to Add the Record.

Examples
Example 1

Adds a new Record to the "MyTable" Table setting the "MyField" and "AnotherField" Fields.

CNSQuery_AddRecord( "MyTable" ; "MyField=Some value¶AnotherField=Some other value" )
Example 2

Adds a new Record to the current Table setting the "MyField" field with a multi-line value.

CNSQuery_AddRecord( "" ; "MyField=A<CR>value<CR>with<CR>multiple<CR>lines" )
Example 3

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

CNSQuery_AddRecord( "AnotherFile.MyTable" ; "MyField=Some value" )