Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Douglas Ludlow 210 posts 366 karma points
    Jul 31, 2013 @ 19:45
    Douglas Ludlow
    0

    Regenerate Contour XML

    Is there a way to regenerate the Contour XML?

    I have about 250 form entries that I'm exporting out to csv and there are 5 or so entries where the xml nodes aren't sorted properly. All the other entries come out just fine. Is there a way to trigger Contour to regenerate the XML for a given entry?

  • Comment author was deleted

    Jul 31, 2013 @ 20:36

    Yeah there is but don't know by heart,will check tomorrow morning

  • Comment author was deleted

    Jul 31, 2013 @ 20:37

    Ah found it with google history

    try to request /umbraco/plugins/umbracoContour/webservices/records.aspx?guid=[FORMGUID]&mode=debug_regen

    need to be running at least v3.0.10

  • Comment author was deleted

    Jul 31, 2013 @ 20:46

    And replace the [FORMGUID] with a valid id of course :)

  • Douglas Ludlow 210 posts 366 karma points
    Aug 01, 2013 @ 23:42
    Douglas Ludlow
    101

    Thanks @TimGessens. Unfortunately that didn't regenerate the xml in the way I thought it would. The xml nodes are still out of order. In the past I edited the excel xslt and removed the sort by caption. This in most cases gave me the desired results, but I found that some were out of order. Now, after regenerating, the majority are out of order. I am running v1.1.13, so perhaps the xml node sorting thing has been fixed in a later version. But the webservice appeared to run okay.

    I ended up just updating the xslt to make it sort by page first, then by fieldset, then by sort order. I'll post it here for the benefit of the community. I'd suggest updating this in future releases of Contour. I don't see any reason why you'd ever want to sort by the caption.

    /umbraco/plugins/umbracoContour/xslt/excel.xslt:

    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt"
    xmlns:user="urn:my-scripts">
      <xsl:output method="text" indent="no" encoding="utf-8" />
      <xsl:param name="records" />
    
      <xsl:template match="/">
        <xsl:text>"State","Submitted","PageId","IP","MemberId",</xsl:text>
        <xsl:for-each select="$records//uformrecord[1]/fields/child::*">
          <xsl:sort select="@pageindex" data-type="number" order="ascending" />
          <xsl:sort select="@fieldsetindex" data-type="number" order="ascending" />
          <xsl:sort select="@sortorder" data-type="number" order="ascending" />
          <xsl:if test="position() != last()">
            <xsl:text>"</xsl:text><xsl:value-of select="normalize-space(translate(caption,',',''))"/><xsl:text>",</xsl:text>
          </xsl:if>
          <xsl:if test="position()  = last()">
            <xsl:text>"</xsl:text><xsl:value-of select="normalize-space(translate(caption,',',''))"/><xsl:text>"&#xD;</xsl:text>
          </xsl:if>
        </xsl:for-each>
        <xsl:for-each select="$records//uformrecord">
          <xsl:text>"</xsl:text>
          <xsl:value-of select="state"/>
          <xsl:text>","</xsl:text>
          <xsl:value-of select="updated"/>
          <xsl:text>","</xsl:text>
          <xsl:value-of select="pageid"/>
          <xsl:text>","</xsl:text>
          <xsl:value-of select="ip"/>
          <xsl:text>","</xsl:text>
          <xsl:value-of select="memberkey"/>
          <xsl:text>",</xsl:text>
          <xsl:for-each select="./fields/child::*">
            <xsl:sort select="@pageindex" data-type="number" order="ascending" />
            <xsl:sort select="@fieldsetindex" data-type="number" order="ascending" />
            <xsl:sort select="@sortorder" data-type="number" order="ascending" />
            <xsl:if test="position() != last()">
              <xsl:choose>
                <xsl:when test="count(values//value) &gt; 1">
                  <xsl:text>"</xsl:text><xsl:for-each select="values//value">
                    <xsl:if test="position() != last()">
                      <xsl:value-of select="normalize-space(translate(.,',',''))"/>
                      <xsl:text>;</xsl:text>
                    </xsl:if>
                    <xsl:if test="position() = last()">
                      <xsl:value-of select="normalize-space(translate(.,',',''))"/>
                    </xsl:if>
                  </xsl:for-each><xsl:text>",</xsl:text>
                </xsl:when>
                <xsl:otherwise>
                  <xsl:text>"</xsl:text>
                  <xsl:value-of select="normalize-space(translate(values//value,',',''))"/>
                  <xsl:text>",</xsl:text>
                </xsl:otherwise>
              </xsl:choose>
            </xsl:if>
            <xsl:if test="position() = last()">
              <xsl:choose>
                <xsl:when test="count(values//value) &gt; 1">
                  <xsl:text>"</xsl:text>
                  <xsl:for-each select="values//value">
                    <xsl:if test="position() != last()">
                      <xsl:value-of select="normalize-space(translate(.,',',''))"/>
                      <xsl:text>;</xsl:text>
                    </xsl:if>
                    <xsl:if test="position() = last()">
                      <xsl:value-of select="normalize-space(translate(.,',',''))"/>
                    </xsl:if>
                  </xsl:for-each>
                  <xsl:text>"</xsl:text>
                </xsl:when>
                <xsl:otherwise>
                  <xsl:text>"</xsl:text>
                  <xsl:value-of select="normalize-space(translate(values//value,',',''))"/>
                  <xsl:text>"</xsl:text>
                </xsl:otherwise>
              </xsl:choose>
              <xsl:text>&#xD;</xsl:text>
            </xsl:if>
          </xsl:for-each>
        </xsl:for-each>
      </xsl:template>
    </xsl:stylesheet>
    
Please Sign in or register to post replies

Write your reply to:

Draft