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

XML.InsertRecords

Imports records from XML file.

Component Version macOS Windows Linux Server iOS SDK
XML 13.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "XML.InsertRecords"; XML; Flags; FileName; TableName )   More

Parameters

Parameter Description Example
XML The XML to process.
Can be XML as text or the reference returned by XML.Parse function, so you can make several times queries to the XML without parsing it each time.
"<test>Hello</test>"
Flags Various Flags.
Add 1 to ignore errors in xml and continue parsing. This may lead to not everything in the xml being read.
0
FileName The file name of where the table is inside. Can be empty to look for the table in all files.

Using a table in another database file may require you adding the other file as an external data source and adding the external table to your relationship graph to grant access.
Get(FileName)
TableName The name of the table to insert record into.
If empty, uses name from XML.
"Assets"

Result

Returns number or error.

Description

Imports records from XML file.
You may need to use various XML functions first to get only the relevant parts of a XML or apply a XLST with XML.ApplyStylesheet first.
XML needs to have a root element with record elements inside and values inside.

If a field is decimal type, we convert value to numeric. Please make sure your number values use dot or comma to match FileMaker's expectation.

Returns number of records inserted or error message.

In contrast to XML.Import, XML.InsertRecords doesn't create table or fields. And XML.InsertRecords doesn't go into deeper levels.

Examples

Insert record:

Set Variable [$r; Value: MBS( "XML.InsertRecords"; "
<Records>
    <Record>
        <Firstname>Joe</Firstname>
        <LastName>Miller</LastName>
        <Age>63</Age>
    </Record>
</Records>";
0; Get(FileName); "Kontakte" ) ]

See also

Release notes

Blog Entries

Created 25th July 2023, last changed 21st September 2023


XML.Import.Work - XML.ItemRefs

💬 Ask a question or report a problem