Forum Discussion

ZachCallaway's avatar
ZachCallaway
Qrew Trainee
7 years ago

Exporting as xml

Hello, 

I currently export a table out as an xml for use with another program. However, when I export the table, not only does the table information get output, but also my user information and apptoken. Is there a way to export an xml that only has the table information and nothing else?

Thanks,
Zach
  • Hi Zach,

    How are you currently pulling out the table as XML? Is this by pulling up the report in an XML format or through the import/export on a table?
  • Hey Evan!

    Thank you for the reply. I am currently using a button I created using the URL Formula field type that is similar to this below:

    URLRoot() & "db/" & Dbid() & "?a=q&qid=1000294&nv=1&v0=" & ToText([Record ID#])

    The button creates an xml of a report that spits out whatever fields you tell it to. However, it doesn't just spit out the fields I select, but also my quickbase user info and apptoken.

    Thanks,
    Zach
    • _anomDiebolt_'s avatar
      _anomDiebolt_
      Qrew Elite
      You can use an XSLT stylesheet to transform the XML response as part of the query.

  • Thank you for the reply!

    Unfortunately this is exactly the function I am using. I use the structured XML, but it still spits out all of my user information and app token. It is just in a structured format.
    • _anomDiebolt_'s avatar
      _anomDiebolt_
      Qrew Elite
      Using an XSLT Stylesheet will allow you to transform the XML response into any format you desire.
    • ZachCallaway's avatar
      ZachCallaway
      Qrew Trainee
      So would this be done in the coding part of the URL formula field?
    • _anomDiebolt_'s avatar
      _anomDiebolt_
      Qrew Elite
      You have to create a XSLT stylesheet and save it in a code page.

      They look like this:
      <?xml version="1.0"?>
      <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                      version="1.0">
              
       <xsl:key name="LabelToField" match="/qdbif/table/fields/field/@id" use="../label"/>
              
       <xsl:template match="/">
        <xsl:apply-templates select="qdbif"/>
       </xsl:template>
       
       <xsl:template match="qdbif">
        <xsl:apply-templates select="table"/>
       </xsl:template>
       <xsl:template match="table">
        <xsl:apply-templates select="records"/>  
       </xsl:template>
        
       <xsl:template match="records">
        <table border="1">
         <tr>
          <th>Field1 Heading</th>
          <th>Field2 Heading</th>
          <th>Field3 Heading</th>
         </tr>
         <xsl:apply-templates select="record"/>
        </table>
       </xsl:template>
       
       <xsl:template match="record">
        <tr>
         <td>
          <xsl:value-of select="f[@id=key('LabelToField','Field1')]"/> 
         </td>
         <td>
          <xsl:value-of select="f[@id=key('LabelToField','Field2')]"/> 
         </td> 
         <td>
          <xsl:value-of select="f[@id=key('LabelToField','Field3')]"/> 
         </td> 
        </tr>
       </xsl:template> 
      </xsl:stylesheet>
      Then you can associate the XSLT stylesheet with (1) a native query or (2) use the xsl parameter with API_DoQuery.

      However, I doubt there are many people that even know how to do this any more and the feature is rarely used or asked about.