Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Hi

I'm trying to import xml data into several fields using Insert From URL. I can get it to all appear in one field but I need it to be distributed into several.

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<MACHINE Generated="2021-06-28T14:19:20+01:00" device="Boris">
<IDLE>TRUE</IDLE>
<IP>172.16.3.202</IP>
<QUEUELENGTH>11</QUEUELENGTH>
<TIME unit="sec">9780</TIME>
</MACHINE>

Is there a way to populate the following fields from tagging onto to my  Insert From URL script.

MACHINE, IDLE, IP, QUEUELENGTH & TIME

I can save the xml into a file and import that way using a .xsl file but I wanted to do this all in one script.

 

16 minutes ago, Plucky said:

I can save the xml into a file and import that way using a .xsl file

You can import an XML file directly from a URL. Going through Insert From URL does not achieve anything useful.

 

  • Author

Hi

I thought I had to use an Insert from URL, Just added the link to the HTTP request window in the Import Records script step and that's worked fine.

I'm ok with importing elements but how can I import the the 2 x attributes.

 

 

<?xml version="1.0" encoding="UTF-8" standalone="no"?><MACHINE Generated="2021-06-28T15:16:06+01:00" device="Boris"><IDLE>FALSE</IDLE><IP>172.16.3.202</IP><QUEUELENGTH>14</QUEUELENGTH><TIME unit="sec">12419</TIME></MACHINE>

 

<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="utf-8" indent="yes"/>

<xsl:template match="/MACHINE">
    <FMPXMLRESULT xmlns="http://www.filemaker.com/fmpxmlresult">
        <METADATA>
            <!-- Job Fields -->
            <FIELD NAME="IDLE"/>
            <FIELD NAME="IP"/>
            <FIELD NAME="QUEUELENGTH"/>
            <FIELD NAME="TIME"/>
            <!-- define more fields here -->
            
        </METADATA>
        <!-- IMPORT DATA -->
        <RESULTSET>
            <xsl:for-each select="MACHINE"/>
            <ROW>
                    <!-- JOB data -->
                    <COL><DATA><xsl:value-of select="IDLE"/></DATA></COL>
                    <COL><DATA><xsl:value-of select="IP"/></DATA></COL>
                    <COL><DATA><xsl:value-of select="QUEUELENGTH"/></DATA></COL>
                    <COL><DATA><xsl:value-of select="TIME"/></DATA></COL>
                </ROW>
        </RESULTSET>
    </FMPXMLRESULT>
</xsl:template>

</xsl:stylesheet>

28 minutes ago, Plucky said:

how can I import the the 2 x attributes

Start by adding the target field names to the METADATA section. Then add a COL for each attribute, using the @  symbol to select the attribute:

<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>

<xsl:template match="/MACHINE">
    <FMPXMLRESULT xmlns="http://www.filemaker.com/fmpxmlresult">
        <METADATA>
            <FIELD NAME="IDLE"/>
            <FIELD NAME="IP"/>
            <FIELD NAME="QUEUELENGTH"/>
            <FIELD NAME="TIME"/>
            <FIELD NAME="Generated"/>
            <FIELD NAME="Device"/>
        </METADATA>
        <RESULTSET>
            <ROW>
                <COL><DATA><xsl:value-of select="IDLE"/></DATA></COL>
                <COL><DATA><xsl:value-of select="IP"/></DATA></COL>
                <COL><DATA><xsl:value-of select="QUEUELENGTH"/></DATA></COL>
                <COL><DATA><xsl:value-of select="TIME"/></DATA></COL>
                <COL><DATA><xsl:value-of select="@Generated"/></DATA></COL>
                <COL><DATA><xsl:value-of select="@device"/></DATA></COL>
            </ROW>
        </RESULTSET>
    </FMPXMLRESULT>
</xsl:template>

</xsl:stylesheet>

Note that I have removed your <xsl:for-each select="MACHINE"/> instruction which - being empty - does nothing and wouldn't do anything even if weren't empty: your template puts you in the context of the root element MACHINE and this element has no child MACHINE elements.

 

  • Author

That did the trick.

Thanks for your help.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.