Jump to content

How to find a range value


fmweb77

This topic is 6811 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hi,

i try to make a form to search a range value

with the old cdml i used

 



        <select size="1" name="-op">

        <option value="gt">greater than</option>

        </select>



        <input type="text" name="field1" size="10"/>



        <select size="1" name="-op">

        <option value="lt">less than</option>

        </select>



        <input type="text" name="field1" size="10"/>





 



Now with xsl i tried to do



 
 





        <select size="1" name="field1.op">

        <option value="gt">greater than</option>

        </select>



        <input type="text" name="field1" size="10"/>



        <select size="1" name="field1.op">

        <option value="lt">less than</option>

        </select>



        <input type="text" name="field1" size="10"/>



 

but doesnt't work..

someone can help me?

thank you! :

Link to comment
Share on other sites

Beverly, -lop=and is the default setting.

The problem actually is that field.op=gt and field.op=lt just work for words and can not be combined. The query specification in the CWP Guide is not clear about that.

I had made once a whole test series that combines different fields and operators, and sent it to FMI, because there are still bugs, especially with field.op=neq . If wished so, I can publish it here.

What you can do, however, is something along the following line:

<input type="hidden" name="field1.op" value="bw"/>

<input type="text" name="field1" size="11" value=">"/>

<input type="hidden" name="field1.op" value="bw"/>

<input type="text" name="field1" size="11" value="<"/>

This is based on the fact that you can use together with "field.op=bw" the field operators that are used within FM Pro.

E.g. for a range search: field.op=bw and field=startrange...endrange

The solution above is still not very pleasant, because the ">" and "<" can be overwritten by the user. I am not sure if this would work as well:

<input type="hidden" name="field1.op" value="bw"/>

<input type="hidden" name="field1" value=">"/>

<input type="text" name="field1" size="10"/>

<input type="hidden" name="field1.op" value="bw"/>

<input type="hidden" name="field1" value="<"/

<input type="text" name="field1" size="10"/>

But just try it out.

If you want to see a very flexible solution, have a look at

http://www.clicaps.ethz.ch/fmi/xsl/search_advanced_en.xsl

and try to search for Title = phys chem and Year > 1990 and Year < 2000.

It looks simpler than it is. There are actually several XSLT stylesheets, JavaScript and XML files with query translation rules involved. And the search is done in two databases at the same time (federated search).

Link to comment
Share on other sites

This topic is 6811 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.