Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
FM.QueryFieldsForTableName
Queries the field names of all fields in the given table.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
FM FMSQL | 3.1 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameters
Parameter | Description | Example | Flags |
---|---|---|---|
TableName | The table name to query. | "test" | |
FileName | The database file name to look into. If empty or missing, we look in current database. (new in 6.2) |
"Contacts" | Optional |
Result
Returns field names of fields separated by return.
Description
Queries the field names of all fields in the given table.See also FM.QueryFieldsForBaseTableName.
Needs permissions to query your database schema via SQL.
Examples
Query field names for Contacts table:
MBS( "FM.QueryFieldsForTableName"; "Contacts" )
Query fields for Kontakte in Kontakte database:
MBS( "FM.QueryFieldsForTableName"; "Kontakte"; "Kontakte" )
Build quoted list of fields:
"\"" & substitute(MBS( "FM.QueryFieldsForTableName"; "Aufgaben" ); ¶; "\"; \"") & "\""
Query fields as JSON:
While([
// query field list
~fields = MBS("FM.QueryFieldsForTableName"; Get(LayoutTableName));
$$json = "{}"
];
// loop over field list
ValueCount(~fields ) > 1;
[
// get field name without spaces and the value from the field
fieldName = Substitute(GetValue(~fields ; 1); " "; "");
fieldValue = Evaluate(Get(LayoutTableName) & "::" & GetValue(~fields; 1));
// add to json as text value
$$json = JSONSetElement ( $$json ; fieldName; fieldValue ; JSONString );
// next
~fields = MiddleValues ( ~fields ; 2; ValueCount(~fields )-1 )
];
$$json)
See also
Release notes
- Version 9.1
- Rewrote FM.QueryFieldsForTableName and FM.QueryFieldsForBaseTableName to avoid join operation and gain better performance with lots of tables.
Blog Entries
- MBS FileMaker Plugin, version 9.1pr1
- Comparing Base Elements Plugin to MBS FileMaker Plugin
- MBS FileMaker Plugin, version 6.2pr3
- MBS Filemaker Plugin, version 3.1pr3
This function checks for a license.
Created 18th August 2014, last changed 6th May 2023