Product Logo

CNS Query

Query your databases without relationships.

Functions

CNSQuery_GetFieldTypes

NameCNSQuery_GetFieldTypes
Description

This function returns either the Field Type of a specific Field or a List of “FieldName=FieldType” pairs for all Fields in a Table. The first parameter is the Name of a Table Occurrence of the Table to return the Field Types from. If you do not specify this parameter, CNS Query will use Get(LayoutTableName) to get the Current Layout TO to return the Field Types from. If you specify a Field Name in the second parameter, CNS Query will return the Field Type of that specific Field. If you do not specify this parameter, CNS Query will return a list of “FieldName=FieldType” pairs for all the Fields in the Table. By default, CNS Query will check to make sure the TO Name and the Field Name you specify exist before getting the Field Types. If you already know for sure that the TO Name and Field name exist, you can pass True as the third and fourth parameters.

Note: In FileMaker Pro 7 through 10, to ensure that you get the Field Types of all the Fields in your Table, you must make sure that there is not a Layout in your Database with the same name as the TO Name you specify for this function. In FileMaker Pro 11 and above, this is no longer an issue.

Return TypeText
FormatCNSQuery_GetFieldTypes ( TOName ; FieldName ; SkipTONameCheck ; SkipFieldNameCheck )
Optional Parameters
TOName

The Name of a Table Occurrence of the Table that contains the Fields. 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

If you specify this parameter, CNS Query will return the Field Type of the Field you specify. Otherwise, CNS Query will return all the Field Type of all the Fields.

SkipTONameCheck

If True, CNS Query will not check to make sure the TO Name you specify actually exists.

SkipFieldNameCheck

If True, CNS Query will not check to make sure the Field Name you specify actually exists.

Examples
Example 1

Returns something like:<br/> AField=Text<br/> BField=Calculation (Number)<br/> CField=Global Timestamp

CNSQuery_GetFieldTypes( "MyTable" )
Example 2

Returns "Text" if the Field Type for the "AField" Field in the current Table is a Text Field.

CNSQuery_GetFieldTypes( "" ; "AField" )
Example 3

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

CNSQuery_GetFieldTypes( "AnotherFile.MyTable" )