MMQuery

Query your databases without relationships.

<- Back to MMQuery function list

MMQuery_GetFieldIDs

Description

This function returns either the ID of a specific Field or a list of "FieldName=FieldID" pairs for all Fields in a Table. The first parameter is the Name of a Table Occurrence of the Table to return the Field IDs from. If you do not specify this parameter, MMQuery will use Get(LayoutTableName) to get the current Table to return the Field IDs from. If you specify a Field Name in the second parameter, MMQuery will return the Field ID of that specific Field. If you do not specify this parameter, MMQuery will return a list of "FieldName=FieldID" pairs for all the Fields in the Table. By default, MMQuery will check to make sure the TO Name and the Field Name you specify exist before getting the Field IDs. If you already know for sure that the TO Name and the 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 IDs 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 not an issue.

Return Type
Text or Number
Format
MMQuery_GetFieldIDs ( 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, MMQuery will return the ID of the Field you specify. Otherwise, MMQuery will return all the IDs of all the Fields.

  • SkipTONameCheck

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

  • SkipFieldNameCheck

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

Related Items
MMQuery_AddField, MMQuery_FieldExists, MMQuery_GetFieldNames, MMQuery_GetFieldTypes, MMQuery_GetFieldValueByFind, MMQuery_GetFieldValueByID, MMQuery_RemoveField, MMQuery_SetFieldValueByFind, MMQuery_SetFieldValueByID
Examples

Example 1

Code:

MMQuery_GetFieldIDs("MyTable")

Result:

Returns something like:<br/>
AField=1<br/>
BField=2

Example 2

Code:

MMQuery_GetFieldIDs("";"BField")

Result:

Returns 2 if the Field ID for the "BField" Field in the current Table is 2.

Example 3

Code:

MMQuery_GetFieldIDs("AnotherFile.MyTable")

Result:

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