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:
9.5
10.0
10.1
10.2
10.3
10.4
10.5
11.0
11.1
11.2
Statistic
FMM
Blog
SQL.GetFieldAsText
Returns field's value as text value; converts if needed.
Component | Version | macOS | Windows | Linux | Server | FileMaker iOS SDK |
SQL | 2.6 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameters
Parameter | Description | Example |
---|---|---|
Command | The command reference number gained with SQL.NewCommand. | $Command |
Field | The name or one based index of the field. | $Field |
Result
Returns text or error message.
Description
Returns field's value as text value; converts if needed.see also:
https://www.sqlapi.com/ApiDoc/class_s_a_field.html
Examples
Read field value of field "FirstName" into variable:
$firstname = MBS("SQL.GetFieldAsText"; $command; "FirstName")
Run a stored procedure:
# new command for calling our test procedure on a Microsoft SQL Server
Set Variable [$command; MBS( "SQL.NewCommand"; $Connection; "dbo.Test" ) ]
# set a parameter
Set Variable [$r; MBS( "SQL.SetParamAsNumber"; $Command; "Param1"; 7 ) ]
# execute query
Set Variable [$r; MBS( "SQL.Execute"; $Command ) ]
# fetch first record
Set Variable [$r; MBS( "SQL.FetchNext"; $Command ) ]
# get result field
Set Variable [$result; MBS( "SQL.GetFieldAsText"; $Command; 1 ) ]
Read null value as empty, otherwise get text:
If(
MBS("SQL.GetFieldIsNull"; $command; "FieldName");
"";
MBS("SQL.GetFieldAsText"; $command; "FieldName"))
See also
- SQL.Connect
- SQL.Execute
- SQL.FetchNext
- SQL.GetFieldAsDate
- SQL.GetFieldAsFloat
- SQL.GetFieldIsNull
- SQL.GetFieldsAsJSON
- SQL.GetParamAsText
- SQL.NewCommand
- SQL.SetParamAsNumber
Example Databases
- SQL to other databases/Firebird Query
- SQL to other databases/Microsoft SQL Execute
- SQL to other databases/Microsoft SQL Server Connect
- SQL to other databases/Microsoft SQL Server Query
- SQL to other databases/MySQL example
- SQL to other databases/MySQL Query
- SQL to other databases/ODBC Query
- SQL to other databases/SQLite blob
- SQL to other databases/SQLite fun
Blog Entries
FileMaker Magazin
Created 18th August 2014, last changed 25th February 2021
SQL.GetFieldAsPNG - SQL.GetFieldAsTime
Feedback: Report problem or ask question.

Links
MBS Xojo Chart Plugins