xforms:submission to SQL processor with replace="instance"

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

xforms:submission to SQL processor with replace="instance"

Roman_

I have been looking through the forums for several hours now, but could not
find somebody with the exact same problem, or where the proposed solution
worked in my case.

I am trying to populate a select1 using an SQL processor, which gets the
values from a database.

The SQL processor seems to work (I can see the query being performed and the
XML being built in the debug output), but the instance I want to be replaced
is not, meaning I do not get the instance with the result of the SQL
processor.

First I tried using an event which fires on xforms-ready and the event
fires, but does not replace the instance. Then I put the processor in the
model of the view and got the result with <xforms:instance src="input:data">
and this actually works. But I still need to get the submission to work, as
I want to use this further for other operations.

I attached the relevant source for the pageflow, the processor and the view.

Any help would be appreciated.

Best regards,

Roman


-- page-flow.xml --

    <page path-info="/xforms-rs3/" view="view.xhtml"
model="service-countries-get.xpl"/>

    <!-- Services -->
    <page path-info="/xforms-rs3/countries-get"
model="service-countries-get.xpl"/>

-- view.xhtml --

            <xforms:instance id="countries_in">
                <dummy xmlns=""/>
            </xforms:instance>

            <xforms:instance id="countries">
                <dummy xmlns=""/>
            </xforms:instance>
           
            <xforms:instance id="countries_2" src="input:data"/>

            <xforms:submission id="countries-get-submission"
ref="instance('countries_in')" replace="instance" instance="countries"
method="post" action="/xforms-rs3/countries-get"/>
            <xforms:send submission="countries-get-submission"
ev:event="xforms-ready"/>

...

        <xforms:trigger>
            <xforms:label>Refresh</xforms:label>
            <xforms:action ev:event="DOMActivate">
                <xforms:send submission="countries-get-submission"/>
            </xforms:action>
        </xforms:trigger>

-- service-countries-get.xpl --

<p:config xmlns:p="http://www.orbeon.com/oxf/pipeline"
        xmlns:sql="http://orbeon.org/oxf/xml/sql"
        xmlns:xs="http://www.w3.org/2001/XMLSchema"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:oxf="http://www.orbeon.com/oxf/processors"
        xmlns:xi="http://www.w3.org/2001/XInclude">

    <p:param type="input" name="instance"/>
    <p:param type="output" name="data"/>

    <p:processor name="oxf:sql">
        <p:input name="data" href="#instance"/>
        <p:input name="config">
            <sql:config>
                <countries xmlns="">
                    <sql:connection>
                        <sql:datasource>db</sql:datasource>
                        <sql:execute>
                            <sql:query>
                                SELECT id, name FROM countries ORDER BY name
                            </sql:query>
                            <sql:result-set>
                                <sql:row-iterator>
                                    <country>
                                        <id>
                                            <sql:get-column-value
type="xs:int" column="id"/>
                                        </id>
                                        <name>
                                            <sql:get-column-value
type="xs:string" column="name"/>
                                        </name>
                                    </country>
                                </sql:row-iterator>
                            </sql:result-set>
                        </sql:execute>
                    </sql:connection>
                </countries>
            </sql:config>
        </p:input>
        <p:output name="data" ref="data"/>
    </p:processor>

</p:config>


--
View this message in context: http://www.nabble.com/xforms%3Asubmission-to-SQL-processor-with-replace%3D%22instance%22-tp16005547p16005547.html
Sent from the ObjectWeb OPS - Users mailing list archive at Nabble.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
Reply | Threaded
Open this post in threaded view
|

Re: xforms:submission to SQL processor with replace="instance"

Alexander Žaťko
I think - in your page-flow.xml file - instead of:

   <!-- Services -->
    <page path-info="/xforms-rs3/countries-get" model="service-
countries-get.xpl"/>

you will need to use:

   <!-- Services -->
    <page path-info="/xforms-rs3/countries-get" view="service-
countries-get.xpl"/>


A.

On Mar 12, 2008, at 5:03 PM, rssc wrote:

>
> I have been looking through the forums for several hours now, but  
> could not
> find somebody with the exact same problem, or where the proposed  
> solution
> worked in my case.
>
> I am trying to populate a select1 using an SQL processor, which gets  
> the
> values from a database.
>
> The SQL processor seems to work (I can see the query being performed  
> and the
> XML being built in the debug output), but the instance I want to be  
> replaced
> is not, meaning I do not get the instance with the result of the SQL
> processor.
>
> First I tried using an event which fires on xforms-ready and the event
> fires, but does not replace the instance. Then I put the processor  
> in the
> model of the view and got the result with <xforms:instance  
> src="input:data">
> and this actually works. But I still need to get the submission to  
> work, as
> I want to use this further for other operations.
>
> I attached the relevant source for the pageflow, the processor and  
> the view.
>
> Any help would be appreciated.
>
> Best regards,
>
> Roman
>
>
> -- page-flow.xml --
>
>    <page path-info="/xforms-rs3/" view="view.xhtml"
> model="service-countries-get.xpl"/>
>
>    <!-- Services -->
>    <page path-info="/xforms-rs3/countries-get"
> model="service-countries-get.xpl"/>
>
> -- view.xhtml --
>
>            <xforms:instance id="countries_in">
>                <dummy xmlns=""/>
>            </xforms:instance>
>
>            <xforms:instance id="countries">
>                <dummy xmlns=""/>
>            </xforms:instance>
>
>            <xforms:instance id="countries_2" src="input:data"/>
>
>            <xforms:submission id="countries-get-submission"
> ref="instance('countries_in')" replace="instance" instance="countries"
> method="post" action="/xforms-rs3/countries-get"/>
>            <xforms:send submission="countries-get-submission"
> ev:event="xforms-ready"/>
>
> ...
>
>        <xforms:trigger>
>            <xforms:label>Refresh</xforms:label>
>            <xforms:action ev:event="DOMActivate">
>                <xforms:send submission="countries-get-submission"/>
>            </xforms:action>
>        </xforms:trigger>
>
> -- service-countries-get.xpl --
>
> <p:config xmlns:p="http://www.orbeon.com/oxf/pipeline"
>        xmlns:sql="http://orbeon.org/oxf/xml/sql"
>        xmlns:xs="http://www.w3.org/2001/XMLSchema"
>        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>        xmlns:oxf="http://www.orbeon.com/oxf/processors"
>        xmlns:xi="http://www.w3.org/2001/XInclude">
>
>    <p:param type="input" name="instance"/>
>    <p:param type="output" name="data"/>
>
>    <p:processor name="oxf:sql">
>        <p:input name="data" href="#instance"/>
>        <p:input name="config">
>            <sql:config>
>                <countries xmlns="">
>                    <sql:connection>
>                        <sql:datasource>db</sql:datasource>
>                        <sql:execute>
>                            <sql:query>
>                                SELECT id, name FROM countries ORDER  
> BY name
>                            </sql:query>
>                            <sql:result-set>
>                                <sql:row-iterator>
>                                    <country>
>                                        <id>
>                                            <sql:get-column-value
> type="xs:int" column="id"/>
>                                        </id>
>                                        <name>
>                                            <sql:get-column-value
> type="xs:string" column="name"/>
>                                        </name>
>                                    </country>
>                                </sql:row-iterator>
>                            </sql:result-set>
>                        </sql:execute>
>                    </sql:connection>
>                </countries>
>            </sql:config>
>        </p:input>
>        <p:output name="data" ref="data"/>
>    </p:processor>
>
> </p:config>
>
>
> --
> View this message in context: http://www.nabble.com/xforms%3Asubmission-to-SQL-processor-with-replace%3D%22instance%22-tp16005547p16005547.html
> Sent from the ObjectWeb OPS - Users mailing list archive at  
> Nabble.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


--
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