Search with or condition

I would like to search two field in or condition. I copy the pages generated by X-Application and find that the condition is AND not OR.
How can I make it to a OR condition?

[This message was edited by Christian Freytag on 26 Jul 2002 at 08:53.]

Hello,

yes you are right. If you define input fields of with name “queryelement”, the resulting expression sent to Tamino connects the elements with AND.

For the next version 3.1.3 (our “summer release”) we implemented a new query handling. Here, you will have less restrictions. A query could look like this:

State:<input type=“text” name=“valState”/>
Contact Person:<input type=“text” name=“valName”/>

<xapp:action type=“query” arg=“/Property[Address/State=‘${valState$}’ or ContactPerson/Name=‘${valName$}’]”></xapp:action>


If you need a workaround for the current version, you could try the following approach.


  • send the values you want to connect via or with plain names.
  • on the next page (e.g. List.jsp) use a directcommand of type=‘query’ and queryparm=‘USEBODY’ and schema=‘’
  • the body of the directcommand tag defines the filter for your query. Use Scriptlets to output the value of your input fields <% … %> within the filter expression, e.g.

    ./ContactPerson/Name=‘<% … %>’ or ./Address/State~=‘<% … %>’



I don’t know if it will work. I never tried it out. You must decide whether you require the OR now or you can wait for the next version of X-Application.

Bye,
Christian.

[This message was edited by Christian Freytag on 26 Jul 2002 at 08:52.]

It cannot work for the next button. When next button is press, the direct command run again and the next result cannot be shown.

Hello,

you could use an if tag for checking if the query was already processed or not. For the current version if is not so easy to find a good condition which checks this, but if you know an element /attribute which is mandatory not empty you can use condition=?empty?. Example

<bdm:if condition=?empty? document=?myDocs? select=?/Property/Price?>

</bdm:if>

(For the next version we will have a condition ?notexist?.)

Also the simple examples of X-Application uses this trick. Have a look at the ?Browse with Navigation? example.

A problem will arise if you have to invoke the directcommand but a set of documents already exists. In this case, I would use Scriptlets. You could check request parameters or use an additional request parameter (e.g. invokequery=true). When entering the page from another page the parameters are set while the Browse Page does not set the parameters. The Scriptlet checks, if the parameter(s) exist(s). If yes, the directcommand is invoked. Example

<% if (…) { %>
<bdm:directcommand …/>
<% } %>

Or expressions possible with X-Application 3.1.3