Discussions

Expand all | Collapse all

Exporting as xml

  • 1.  Exporting as xml

    Posted 11-08-2018 15:40
    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


  • 2.  RE: Exporting as xml

    Posted 11-08-2018 19:03
    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?


  • 3.  RE: Exporting as xml

    Posted 11-08-2018 21:04
    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


  • 4.  RE: Exporting as xml

    Posted 11-09-2018 16:33
    You can use an XSLT stylesheet to transform the XML response as part of the query.



  • 5.  RE: Exporting as xml

    Posted 11-09-2018 16:55
    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.


  • 6.  RE: Exporting as xml

    Posted 11-09-2018 16:57
    Using an XSLT Stylesheet will allow you to transform the XML response into any format you desire.


  • 7.  RE: Exporting as xml

    Posted 11-09-2018 18:34
    So would this be done in the coding part of the URL formula field?


  • 8.  RE: Exporting as xml

    Posted 11-12-2018 15:49
    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"">http://www.w3.org/1999/XSL/Transform"">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.


  • 9.  RE: Exporting as xml

    Posted 11-14-2018 15:37
    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?


  • 10.  RE: Exporting as xml

    Posted 11-14-2018 15:44
    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.


  • 11.  RE: Exporting as xml

    Posted 11-14-2018 16:27
    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">">http://www.w3.org/1999/XSL/Transform">">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:

    ">https://d2r1vs3d9006ap.cloudfront.net/s3_images/1762220/RackMultipart20181114-127200-1d0snu2-Capture_inline.JPG?1542212741">

    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.


  • 12.  RE: Exporting as xml

    Posted 11-14-2018 18:15
    You can contact me off-world using the information in my profile if you want individualized help:

    https://getsatisfaction.com/people/dandiebolt">https://getsatisfaction.com/people/dandiebolt">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.