Exporting as xml

  • 0
  • 1
  • Question
  • Updated 1 month ago
  • In Progress
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
Photo of Zach Callaway

Zach Callaway

  • 140 Points 100 badge 2x thumb

Posted 1 month ago

  • 0
  • 1
Photo of Evan Martinez

Evan Martinez, Community Manager

  • 9,266 Points 5k badge 2x thumb
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?
Photo of Zach Callaway

Zach Callaway

  • 140 Points 100 badge 2x thumb
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
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 28,004 Points 20k badge 2x thumb
You can use an XSLT stylesheet to transform the XML response as part of the query.

Photo of Zach Callaway

Zach Callaway

  • 140 Points 100 badge 2x thumb
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.
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 28,134 Points 20k badge 2x thumb
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.
Photo of Zach Callaway

Zach Callaway

  • 140 Points 100 badge 2x thumb
So I have looked into it a little bit and I have used my xml with an xsl to get what I want from an xml/xsl conversion website: https://www.freeformatter.com/xsl-transformer.html

However, I am not sure how to bring the xsl into quickbase to be used. The portion of the report I made gives me this option:




but you cannot just upload a file. Do you know by chance how to get the xsl file into this box correctly?
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 28,134 Points 20k badge 2x thumb
You create a code page (HOME | Settings | Pages | New | Code Page) and give it a name such as mystylesheet.xslt. Then put the name into the "Associated XSL Doxcument" input.
Photo of Zach Callaway

Zach Callaway

  • 140 Points 100 badge 2x thumb
Thanks! I ran the code in the website sent earlier.

Here is the XML:

<?xml version="1.0" encoding="utf-8" ?> 
<qdbif version="1">
<qid>5</qid>
<qname>cr auto</qname>
<table>
<name>case reports</name>

<original>

<cre_date>1541797864167</cre_date>
<mod_date>1542207058095</mod_date>
<next_record_id>3</next_record_id>
<next_field_id>14</next_field_id>
<next_query_id>6</next_query_id>
<def_sort_fid>2</def_sort_fid>
<def_sort_order>1</def_sort_order>
<key_fid>3</key_fid>
<single_record_name>case</single_record_name>
<plural_record_name>cases</plural_record_name>

</original>

<queries>
<query id="5">
<qyname>cr auto</qyname>
<qytype>table</qytype>
<qyclst>6.7.8</qyclst>
<qyopts>xst.nos.qws.</qyopts>
<qycalst>0.0</qycalst>
</query>
<query id="1">
<qyname>List All</qyname>
<qytype>table</qytype>
<qyopts>nos.qws.</qyopts>
<qycalst>0.0</qycalst>
</query>
<query id="2">
<qyname>List Changes</qyname>
<qytype>table</qytype>
<qydesc>Sorted by Date Modified</qydesc>
<qyslst>2</qyslst>
<qyopts>so-D.onlynew.nos.qws.</qyopts>
<qycalst>0.0</qycalst>
</query>
</queries>
<fields>
<field id="6" field_type="text" base_type="text">
<label>Name</label>
<nowrap>0</nowrap>
<bold>0</bold>
<required>0</required>
<appears_by_default>1</appears_by_default>
<find_enabled>1</find_enabled>
<allow_new_choices>0</allow_new_choices>
<sort_as_given>1</sort_as_given>
<carrychoices>1</carrychoices>
<foreignkey>0</foreignkey>
<unique>0</unique>
<doesdatacopy>1</doesdatacopy>
<fieldhelp/>
<audited>0</audited>
<num_lines>1</num_lines>
<maxlength>0</maxlength>
<append_only>0</append_only>
<allowHTML>0</allowHTML>
</field>
<field id="7" field_type="text" base_type="text" mode="virtual">
<label>Surgeon</label>
<nowrap>0</nowrap>
<bold>0</bold>
<required>0</required>
<appears_by_default>1</appears_by_default>
<find_enabled>1</find_enabled>
<allow_new_choices>0</allow_new_choices>
<sort_as_given>1</sort_as_given>
<formula/>
<carrychoices>1</carrychoices>
<foreignkey>0</foreignkey>
<unique>0</unique>
<doesdatacopy>0</doesdatacopy>
<fieldhelp/>
<audited>0</audited>
<num_lines>1</num_lines>
<maxlength>0</maxlength>
<append_only>0</append_only>
<allowHTML>0</allowHTML>
</field>
<field id="8" field_type="float" base_type="float">
<label>phone</label>
<nowrap>1</nowrap>
<bold>0</bold>
<required>0</required>
<appears_by_default>1</appears_by_default>
<find_enabled>1</find_enabled>
<allow_new_choices>0</allow_new_choices>
<sort_as_given>1</sort_as_given>
<carrychoices>1</carrychoices>
<foreignkey>0</foreignkey>
<unique>0</unique>
<doesdatacopy>1</doesdatacopy>
<fieldhelp/>
<audited>0</audited>
<comma_start>4</comma_start>
<numberfmt>3</numberfmt>
<does_average>0</does_average>
<does_total>1</does_total>
<blank_is_zero>1</blank_is_zero>
</field>
</fields>
<lastluserid>0</lastluserid>
<records>
<record>
<f id="6">gwatcha</f>
<f id="7"/>
<f id="8">80085</f>
<update_id>1541798055457</update_id>
</record>
<record>
<f id="6">diablo</f>
<f id="7"/>
<f id="8">2123</f>
<update_id>1541799272650</update_id>
</record>
</records>
</table>
</qdbif>




Here is the XSL:

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

<xsl:template match="node() | @*">
    <xsl:copy>
        <xsl:apply-templates select="node() | @*"/>
    </xsl:copy>
</xsl:template>

<xsl:template match="original"/>

</xsl:stylesheet>



On the website it removes the <original> tag like it is supposed to. However, when I make it a user defined page and enter the code through quickbase, this is what I get:



is there a certain xsl format that I need to use that is hindering this function? All I want to do is remove several of the tags from the original xml.
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 28,134 Points 20k badge 2x thumb
You can contact me off-world using the information in my profile if you want individualized help:

https://getsatisfaction.com/people/dandiebolt

I can't really give you a lot of encouragement to pursue an XSLT solution in the public forum as this technology has largely become obsolete. Ironically, this was one of the early features that drew me to QuickBase almost 20 years ago and I became an expert in it at the time.

But the fact is that nobody really uses this technology any more for a variety of technical reasons.