Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Guides   Examples
New in version: 7.1   7.2   7.3   7.4   7.5   8.0   8.1   8.2   8.3   8.4    Statistic  

FM.ExecuteSQLOnIdle

This is similar to FM.ExecuteSQL, except that it waits until idle to execute.

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
FM FMSQL 1.2 Yes Yes No No No

MBS( "FM.ExecuteSQLOnIdle"; SQL Statement { ; Column Delimiter; Record Delimiter; Params } )

Parameters

Parameter Description Example value
SQL Statement the SQL statement
Column Delimiter Optional
Optional column delimiter
Record Delimiter Optional
Optional record delimiter
Params Optional
Optional, pass here parameters. One parameter to this function for each parameter you want to pass to the SQL statement.
123

Description

This is similar to FM.ExecuteSQL, except that it waits until idle to execute.
You run a script pause after using this function to give it time to execute.
See the other function for more info.
Seems like on FileMaker 11 you get LastError 8310 if you use fields with underscore in the name. You avoid that by placing the field names in quotes.

Use FM.ExecuteSQL.LastErrorMessage and FM.ExecuteSQL.LastError to see error message. Use FM.ExecuteFileSQL if you want to specify the file name.

When you create fields, you can use the following types. Add global on the end to make it a global field.

FileMaker TypeSQL Type
Textvarchar
Numberdecimal
Datedate
Timetime
Timestamptimestamp
Containerbinary

Examples

Create a new text field in a table:

MBS("FM.ExecuteSQLOnIdle";"ALTER TABLE TestTable ADD MyField varchar")

And delete the field:

MBS("FM.ExecuteSQLOnIdle";"ALTER TABLE TestTable DROP COLUMN MyField")

Create new table:

MBS("FM.ExecuteSQLOnIdle";"CREATE TABLE \"MyTABLE\" (test varchar)")

Create new index:

MBS("FM.ExecuteSQLOnIdle";"CREATE INDEX \"IndexLastname\" ON \"Persons\" (\"LastName\");")

Add a global field:

MBS("FM.ExecuteSQLOnIdle";"ALTER TABLE TestTable ADD MyGlobalField varchar global")

See also

Example Databases

Created 18th August 2014, last changed 21st January 2018


FM.ExecuteSQL.LastSQL   -   FM.GetSQLBatchMode

Feedback: Report problem or ask question.




Links
MBS Xojo Plugins