Topics
All
MacOS
(Only)
Windows
(Only)
Linux
(Only, Not)
iOS
(Only, Not)
Components
Crossplatform Mac & Win
Server
Client
Old
Deprecated
Guides
Examples
Videos
New in version:
12.1
12.2
12.3
12.4
12.5
13.0
13.1
13.2
13.3
13.4
Statistic
FMM
Blog
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 |
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 |
Returns field names of fields separated by return.
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)
This function checks for a license.
Created 18th August 2014, last changed 6th May 2023