Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old


Performs import.

Component Version macOS Windows Linux Server iOS SDK
XML 5.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "XML.Import.Work" )




Returns OK or error.


Performs import.
Normally we do import on idle while a script pause. But on server this does not work.
You can call this method in a loop to do the inserts for the import.
But it will not create the tables and fields required for import.

If you call XML.Import.Work manually, you may not need a script pause, except if fields and tables should be created.

Changed in version 11.3 to use per thread data, so multiple scripts on server can do imports independently. Please make sure you call all JSON.Import functions on the same script, so they can access their own local dataset and not interfere with other scripts doing imports.

We use SQL to create records, so you can check FM.ExecuteSQL.LastErrorMessage and FM.ExecuteSQL.LastSQL after the import for SQL errors.


Import on server:

Set Variable [$text; Value:MBS("Text.ReadTextFile"; "/Users/cs/Desktop/test.xml"; "UTF-8")]
Set Variable [$r; Value:MBS("XML.Import"; $text; ""; "")]
Set Variable [$text; Value:""]
If [MBS("IsError") = 0]
    Set Variable [$total; Value:MBS("XML.Import.Total")]
        Set Variable [$work; Value:MBS("XML.Import.Work")]
        Set Variable [$status; Value:MBS("XML.Import.Status")]
        Exit Loop If [$status ≠ "Working"]
    End Loop
End If

See also

Example Databases

Blog Entries

This function checks for a license.

Created 10th November 2015, last changed 2nd February 2023

XML.Import.Total - XML.InsertRecords