How can I get results from a search into xforms?

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

How can I get results from a search into xforms?

masjab-2
Hey,

I am trying to write a searchSite for my Xform. My data is stored in  
an eXist-database. Now the user can make his query my filling out a  
form. After he presses on "search" my search.xq (in exist) looks for  
the data and returns it.
This works fine but my programm/site has a navigation that is included  
to all pages.

When my search.xq returns the data, a new page comes up(the data is in  
a table then).
But I want the rest of the site, too...

I tried to include XFORMS-Code into my "return"  statement, but no  
luck....

Any suggestions?



--
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: How can I get results from a search into xforms?

fl.schmitt(ops-users)
hi Masen,

> When my search.xq returns the data, a new page comes up(the data is in a
> table then).
> But I want the rest of the site, too...

Do you use replace="all" in your submission element? Try using
replace="instance" and instance="result-instance", to replace just a
specific instance that will hold the search result.

HTH
florian




--
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: Re: How can I get results from a search into xforms?

masjab-2
ok, I´ll try this an let you know what happens...
THX!

Am 25.06.2008 um 14:19 schrieb Florian Schmitt:

> hi Masen,
>
>> When my search.xq returns the data, a new page comes up(the data is  
>> in a table then).
>> But I want the rest of the site, too...
>
> Do you use replace="all" in your submission element? Try using  
> replace="instance" and instance="result-instance", to replace just a  
> specific instance that will hold the search result.
>
> HTH
> florian
>
>
>
> --
> 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
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: How can I get results from a search into xforms?

masjab-2
Sorry, not working...
My submission looks like:
<xforms:submission id="search" ref="instance('search-Data')"
                method="post"/>

when I press the "search" button my browser url looks like:

when I change it to:
<xforms:submission id="search" ref="instance('search-Data')"
                method="post" instance="search-result"/>

nothing happens.



--
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: Re: Re: Re: How can I get results from a search into xforms?

marc-62
Masen J a écrit :

> Sorry, not working...
> My submission looks like:
> <xforms:submission id="search" ref="instance('search-Data')"
>                
> resource="http://localhost:8080/exist/rest/db/dictionary/xquery/search.xq"
>                 method="post"/>
>
> when I press the "search" button my browser url looks like:
> http://localhost:8080/orbeon/xforms-server-submit
>
> when I change it to:
> <xforms:submission id="search" ref="instance('search-Data')"
>              
>   resource="http://localhost:8080/exist/rest/db/dictionary/xquery/search.xq"
>                 method="post" instance="search-result"/>
>
> nothing happens.
>
Masen J, you can try :

<xforms:submission id="search" ref="instance('search-Data')"
             
  resource="http://localhost:8080/exist/rest/db/dictionary/xquery/search.xq"
                method="post"
                replace="instance"
                instance="search-result"/>

HTH, Marc


--
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: Re: Re: Re: Re: How can I get results from a search into xforms?

masjab-2
Hey; 

Masen J, you can try :

<xforms:submission id="search" ref="instance('search-Data')"
             resource="http://localhost:8080/exist/rest/db/dictionary/xquery/search.xq"
              method="post"
              replace="instance"
              instance="search-result"/>

Well, this is what I did..but still not working...
Is it maybe because of "what" is returned... my search.xq does return a whole html page...the search.xq looks like this:

xquery version "1.0";
declare namespace exist = "http://exist.sourceforge.net/NS/exist";
declare namespace xmldb = "http://exist-db.org/xquery/xmldb";
declare namespace request="http://exist-db.org/xquery/request";
declare option exist:serialize "method=html media-type=text/html indent=yes";
let $sD := request:get-data()
let $coll1 := xmldb:xcollection('/db/dictionary/data')//entry
return 

<html>
<table>
<thead>
      <tr>
          <th>Nr</th>
          <th>Lemma</th> 
          <th>Root</th>
          <th>Meaning</th>
      </tr>
    </thead>
{
let $test :='child::*[./fn:name()=lemma]=Heno' 
for $row in $sD/search/select
let $name := string($row/name)
let $value := string($row/value)
let $interpretAs := string($row/interpretAs)
let $operator := string($row/operator) 

for $search at $count in
 for $result in $coll1 
  where $result[child::*[./fn:name() = $name] = $value]  
  return $result
return 

<tr>{if ($count mod 2) then (attribute {'bgcolor'} {'Lavender'}) else ()}
    <td>{$count}</td>
    <td>{$search/lemma}</td>
    <td>{$search/root}</td>
   <td>
    <table>
    {

    

        for $repeatMeaning at $countMeaning in
            for $meaning in $search/meaning
            return $meaning
        return

  

        <tr>
          <td>{$countMeaning}</td>
          <td>{$repeatMeaning/description}</td>
        </tr>
    }
    </table>
    </td>
        <td>{$search/category}
    </td>

    <!--
    <td>{$search/meaning/description}</td>

    

    <td>{$search/meaning/source/kindOfSource}</td>
    <td>{$search/meaning/source/nameOfSource}</td>
    <td>{$search/files/file}</td>-->
</tr>
}
</table>
</html>




--
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: Re: Re: Re: Re: How can I get results from a search into xforms?

masjab-2
In reply to this post by marc-62
Ok, 
after I´ve deleted this line in my search.xq :

declare option exist:serialize "method=html media-type=text/html indent=yes";

my instance was filled with the htmlContent.
But what can I do with it?
Is it better to only the xml-Data into my result instance and create a new view that displays the content?

Please, this is too much for me...=(

THX´s for your help



--
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: Re: Re: Re: Re: Re: How can I get results from a search into xforms?

masjab-2
ok, at least I have a plan...
If someone does know better, please let me know:

i) when my searchPage does the submission it should store the returned xml-data in a local result.xml
ii) the search submission also loads a results.xhtml that loads the results.xml data an put´s it into a table...

Is this ok?Or what do you think...   







Am 26.06.2008 um 17:23 schrieb Masen J:

Ok, 
after I´ve deleted this line in my search.xq :

declare option exist:serialize "method=html media-type=text/html indent=yes";

my instance was filled with the htmlContent.
But what can I do with it?
Is it better to only the xml-Data into my result instance and create a new view that displays the content?

Please, this is too much for me...=(

THX´s for your help


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: [hidden email]
For general help: [hidden email]
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
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Re: Re: Re: Re: How can I get results from a search into xforms?

masjab-2
OH NO, 
I think this is not gonna work...
If someone else overwrites the results.xml (there are more than one user)...

Please, can someone help me a little bit with the session-attributes...
I think I have to store the results sessionbased and I am still not very sure how this should work...=(

THX




Am 26.06.2008 um 19:41 schrieb Masen J:

ok, at least I have a plan...
If someone does know better, please let me know:

i) when my searchPage does the submission it should store the returned xml-data in a local result.xml
ii) the search submission also loads a results.xhtml that loads the results.xml data an put´s it into a table...

Is this ok?Or what do you think...   







Am 26.06.2008 um 17:23 schrieb Masen J:

Ok, 
after I´ve deleted this line in my search.xq :

declare option exist:serialize "method=html media-type=text/html indent=yes";

my instance was filled with the htmlContent.
But what can I do with it?
Is it better to only the xml-Data into my result instance and create a new view that displays the content?

Please, this is too much for me...=(

THX´s for your help


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: [hidden email]
For general help: [hidden email]
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: [hidden email]
For general help: [hidden email]
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
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Re: Re: Re: How can I get results from a search into xforms?

masjab-2
In reply to this post by masjab-2
Can anyone please tell me how to get returned data from a xquery into my session-data?
@Erik
Some time ago you wrote to me:

BTW we have an xxforms:get-session-attribute() function in the nightly builds, and we will be adding an xxforms:set-session-attribute() as well soon. This could help you I think if you want to use the user's session to store language and other application-global preferences.


Can you give me an example how to use it?

THX


--
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: Re: Re: Re: Re: Re: Re: How can I get results from a search into xforms?

Erik Bruchez
Administrator
There is some new doc here:

   http://www.orbeon.com/ops/doc/reference-xforms-functions

Just search for get-session-attribute() and set-session-attribute().

-Erik

On Jun 26, 2008, at 4:02 PM, Masen J wrote:

> Can anyone please tell me how to get returned data from a xquery  
> into my session-data?
> @Erik
> Some time ago you wrote to me:
>
> BTW we have an xxforms:get-session-attribute() function in the  
> nightly builds, and we will be adding an xxforms:set-session-
> attribute() as well soon. This could help you I think if you want to  
> use the user's session to store language and other application-
> global preferences.
>
>
> Can you give me an example how to use it?
>
> THX
>
> --
> 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
--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.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: How can I get results from a search into xforms?

fl.schmitt(ops-users)
In reply to this post by masjab-2
hi Masen,

> Can anyone please tell me how to get returned data from a xquery into my
> session-data?

What do you want exactly to achieve? To access just the search result,
you don't have to save it in the session scope. You can replace any
instance of your xforms with the XML result, so you can bind any
controls to it directly, use xforms:groups to display or hide parts of
your page depending of the ressult content, and so on. Also, you don't
have to build a new xforms page to display the results (but you can, of
course, if you want to). IMHO the easiest way is just to take xquery XML
output into a instance and access it directly.

florian




--
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: Re: Re: Re: Re: Re: How can I get results from a search into xforms?

Alessandro Vernet
Administrator
In reply to this post by masjab-2
Masen,

On Thu, Jun 26, 2008 at 6:08 AM, Masen J <[hidden email]> wrote:

> <xforms:submission id="search" ref="instance('search-Data')"
>              resource="http://localhost:8080/exist/rest/db/dictionary/xquery/search.xq"
>               method="post"
>               replace="instance"
>               instance="search-result"/>
>
> Well, this is what I did..but still not working...
> Is it maybe because of "what" is returned... my search.xq does return a
> whole html page...the search.xq looks like this:
> xquery version "1.0";
> declare namespace exist = "http://exist.sourceforge.net/NS/exist";
> declare namespace xmldb = "http://exist-db.org/xquery/xmldb";
> declare namespace request="http://exist-db.org/xquery/request";
> declare option exist:serialize "method=html media-type=text/html
> indent=yes";
> let $sD := request:get-data()
> let $coll1 := xmldb:xcollection('/db/dictionary/data')//entry
> return
> <html>
> <table>
> <thead>
>       <tr>
>           <th>Nr</th>
>           <th>Lemma</th>
>           <th>Root</th>
>           <th>Meaning</th>
>       </tr>
>     </thead>
> {
> let $test :='child::*[./fn:name()=lemma]=Heno'
> for $row in $sD/search/select
> let $name := string($row/name)
> let $value := string($row/value)
> let $interpretAs := string($row/interpretAs)
> let $operator := string($row/operator)
> for $search at $count in
>  for $result in $coll1
>   where $result[child::*[./fn:name() = $name] = $value]
>   return $result
> return
> <tr>{if ($count mod 2) then (attribute {'bgcolor'} {'Lavender'}) else ()}
>     <td>{$count}</td>
>     <td>{$search/lemma}</td>
>     <td>{$search/root}</td>
>    <td>
>     <table>
> [...]
Your query is returning HTML, which is fairly unusual. Instead, what I
would recommend is for the XQuery to return XML with "just the data",
to store that XML in an instance, and to have the HTML inside the
form. Does this make sense?

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/
Twitter - http://twitter.com/avernet


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