Pass instance value to where clause REST/eXist xquery

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

Pass instance value to where clause REST/eXist xquery

brian_steuhl-2
Use case:
User chooses a value from select1 control.  Selection sends a submission using
REST and xquery to filter xml file and return results to populate second
select1 control.  User chooses value from second select1 control and another
REST submission is sent (different submission id) to eXist to return results.
I am trying to send an instance value from this second select1 control to
filter results back from eXist to populate the third select1 control replacing.
 All three select1 control have there own instances. Below is my Submission:

<xforms:submission id="section_submission" method="get"
resource="http://localhost:8600/exist/rest/db/?_query=for $b in
(doc('mcc.xml')/Import/Row) where
$b/Section={instance('sections')/Charge_Info/Section} return
&lt;Charge_Info1&gt;{{$b/Subsection}}&lt;/Charge_Info1&gt;"
 xforms:show-progress="false"  replace="instance"
xxforms:instance="subsections" xxforms:username="admin" xxforms:password="">
        <xforms:message ev:event="xforms-submit-error" level="modal">Operation
failed.</xforms:message>
</xforms:submission>

It appears as though eXist only wants a string value because there is no xml
schema to the xml file so it is untypedAtomic. If a pass a static value as a
string, I get the results back.  When I enclose the above instance on single
quotes (hoping that would work) I get nothing back.

Here is the select1 control that sends the submission:

                <xforms:select1 ref="instance('sections')" appearance="minimal"
style="width:3in" xmlns="">
           <xforms:label>Select Section: </xforms:label>
         <xforms:item>
           <xforms:label>Section</xforms:label>
           <xforms:value/>
        </xforms:item>
        <xforms:itemset nodeset="instance('sections')/Charge_Info[not(Section =
preceding-sibling::Charge_Info/Section)]" xmlns="">
           <xforms:label ref="Section"/>
           <xforms:value ref="Section"/>
        </xforms:itemset>
        <xforms:action ev:event="xforms-value-changed">
          <xforms:send submission="section_submission"/>
        </xforms:action>
        </xforms:select1>

Thanks.


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Pass instance value to where clause REST/eXist xquery

Alessandro Vernet
Administrator
Brian,

On Thu, Mar 27, 2008 at 2:57 PM,  <[hidden email]> wrote:

>  <xforms:submission id="section_submission" method="get"
>  resource="http://localhost:8600/exist/rest/db/?_query=for $b in
>  (doc('mcc.xml')/Import/Row) where
>  $b/Section={instance('sections')/Charge_Info/Section} return
>  &lt;Charge_Info1&gt;{{$b/Subsection}}&lt;/Charge_Info1&gt;"
>   xforms:show-progress="false"  replace="instance"
>  xxforms:instance="subsections"  xxforms:username="admin" xxforms:password="">
>         <xforms:message ev:event="xforms-submit-error" level="modal">Operation
>  failed.</xforms:message>
>  </xforms:submission>
It looks like there is at least a quoting issue you might need to take
care of in this query, as I was mentioning yesterday in this message:

http://www.nabble.com/Re%3A-Re%3A-Re%3A-Re%3A-Re%3A-Select1-control-not-shoing-all-values-p16468086.html

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
Personal Blog: http://avernet.blogspot.com/


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws