use xforms:submission processor to create a new item in an exist collection?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

use xforms:submission processor to create a new item in an exist collection?

Jim.Kirby
Hi,

I am currently using the oxf:xforms-submission processor to persist data in an exist collection. Is there a way to use this processor to create a new item in the collection each time the submission runs rather then overwriting the contents?

Thanks,
Jim

Here is the code I am using
---------------------------------
<p:processor name="oxf:xforms-submission"> 
   <p:input transform="oxf:xslt" name="submission"> 
      <xforms:submission method="put" action="/exist/rest/db/StabOps/newOrg/" seperator="&"/> 
   </p:input> 
   <p:input transform="oxf:xslt" name="request" href="#data-transformed"> 
        <element1 xsl:version="2.0"> 
                <xsl:copy-of select="."/> 
        </element1> 
   </p:input> 
    <p:output name="response" ref="data"/> 
</p:processor>
Reply | Threaded
Open this post in threaded view
|

Re: use xforms:submission processor to create a new item in an exist collection?

Jim.Kirby
Hi,

Okay, I think got the problem mostly solved but not totally:) I modified the form runner app to read an id number contained in a OID element from a OID collection (<OID>1</OID>) then write that number (incremented by 1) back to the collection. Next the id number is appended onto the name for the stored document (/exist/rest/db/TransformedItems/Item1,/exist/rest/db/TransformedItems/Item2,etc..). The problem is the second oxf:xforms-submission (that increments the id) does not seem to run and the id does not get incremented. If i remove the last submission (that puts the file into exist) then the read/increment/write process works fine. Any Ideas or suggestions?

   
    <p:processor name="oxf:xforms-submission">
        <p:input name="submission">
        <xforms:submission method="get" action="/exist/rest/db/Counter/OID/" seperator="&amp;"/>
        </p:input>
        <p:input name="request" href="#instance"/>
        <p:output name="response" id="currentOID"/>
    </p:processor>       
       
   
    <p:processor name="oxf:xforms-submission">
        <p:input name="submission">
        <xforms:submission method="put" action="/exist/rest/db/Counter/OID/" seperator="&amp;"/>
        </p:input>
        <p:input transform="oxf:xslt" name="request" href="#currentOID">
        <OID xsl:version="2.0"><xsl:value-of select="/OID + 1"/></OID>
        </p:input>
        <p:output name="response" id="OIDresponse"/>
    </p:processor>
   
     
     <p:processor name="oxf:xforms-submission">
        <p:input transform="oxf:xslt" name="submission" href="#currentOID">
        <xforms:submission method="put" seperator="&amp;" xsl:version="2.0">
          <xsl:attribute name="action">
                  /exist/rest/db/TransformedItems/Item<xsl:value-of select="/OID" />
          </xsl:attribute>
        </xforms:submission>
        </p:input>
        <p:input transform="oxf:xslt" name="request" href="#data-transformed">
        <Element xsl:version="2.0">
           <xsl:copy-of select="."/>
        </Element>
         </p:input>
        <p:output name="response" ref="data"/>
    </p:processor>

Jim

Jim.Kirby wrote
Hi,

I am currently using the oxf:xforms-submission processor to persist data in an exist collection. Is there a way to use this processor to create a new item in the collection each time the submission runs rather then overwriting the contents?

Thanks,
Jim

Here is the code I am using
---------------------------------
<p:processor name="oxf:xforms-submission"> 
   <p:input transform="oxf:xslt" name="submission"> 
      <xforms:submission method="put" action="/exist/rest/db/StabOps/newOrg/" seperator="&"/> 
   </p:input> 
   <p:input transform="oxf:xslt" name="request" href="#data-transformed"> 
        <element1 xsl:version="2.0"> 
                <xsl:copy-of select="."/> 
        </element1> 
   </p:input> 
    <p:output name="response" ref="data"/> 
</p:processor>