Logo BioPD  

13. How to Perform a Search in More Than a Field


To introduce this topics we should explain at first how queries are processed bu SFgate.
If you have more than an Input Box, then SFgate builds the query like this:

This means that queries are not processed from left to right!

So when you fill in more than an Input Box and submit the query, pay attention to the diagnostics given back from SFgate!
Maybe this is not exactly what you want!
Suppose we want to find a person belonging to the department of biology whose name is
Giorgio Valle beside all people belonging to the Institute of ISTOLOGIA.
The first obvious idea is to perform a query like this:

 

If you tested the LIVE example above, you didn't get what you expected!
This is exactly because of how SFgate processes queries.

So, to avoid unexpected results it is better not to create forms with more than two Input Boxes.

You can't perform a question like the one proposed with SFgate using a simple form.
You have to use form containing
Textarea or use Field Groups.


Here you can the .fmt file while the relevant part of this form source code is here:

<FORM METHOD=POST ACTION="/htbin/SFgate">
<INPUT NAME="database" TYPE="hidden" VALUE="phone_attribute">

<CENTER>
<TABLE BORDER WIDTH=70%>
   <TR><TD><SELECT NAME="fieldsel_1_description">
              <OPTION SELECTED>Surname
              <OPTION>Name
              <OPTION>Department
            </SELECT></TD>
        <TD><INPUT TYPE="text" NAME="fieldsel_1_content" VALUE="valle" SIZE=40></TD>
 
        <TD><SELECT NAME="fieldsel_2_tie">
               <OPTION>and
               <OPTION SELECTED>or
            </SELECT></TD></TR>

    <TR><TD><SELECT NAME="fieldsel_2_description">
               <OPTION>Surname
               <OPTION SELECTED>Name
               <OPTION>Department
            </SELECT></TD>
        <TD><INPUT TYPE="text" NAME="fieldsel_2_content" VALUE="giorgio" SIZE=40></TD>

        <TD><SELECT NAME="fieldsel_3_tie">
               <OPTION>and
               <OPTION SELECTED>or
            </SELECT></TD></TR>


    <TR><TD><SELECT NAME="fieldsel_3_description">
                <OPTION>Surname
                <OPTION>Name
                <OPTION SELECTED>Department
            </SELECT></TD>
        <TD><INPUT TYPE="text" NAME="fieldsel_3_content" VALUE="istologia" SIZE=40></TD>
</TABLE>
</CENTER>
<P>

<INPUT TYPE="hidden" NAME="fieldsel_name_surname" VALUE="Surname">
<INPUT TYPE="hidden" NAME="fieldsel_name_name" VALUE="Name">
<INPUT TYPE="hidden" NAME="fieldsel_name_department" VALUE="Department">

<CENTER>
<TABLE>
<TR><TH><INPUT TYPE="submit" VALUE="Start Search">
</TH><TH> </TH><TH>
<INPUT TYPE="reset"  VALUE="Reset Query"></TR>
</TABLE>
</CENTER>
<P>

<INPUT TYPE="hidden" NAME="tieinternal" VALUE="and">
<INPUT TYPE="hidden" NAME="application" VALUE="phone">
<INPUT TYPE="hidden" NAME="convert" VALUE="Table">
<INPUT TYPE="hidden" NAME="attributes" VALUE="1">
<INPUT TYPE="hidden" NAME="lattice" VALUE="phone_lattice">
</FORM>

Instead of allowing to the user the definition of Boolean operators to use, it is possible to define a Boolean Operator linking in a hidden way all the Input Boxes.
This can be done using a tag like this:

<INPUT TYPE="hidden" NAME="tie" VALUE="and">

In this case all the fields are connected with an hidden AND.

<INPUT TYPE="hidden" NAME="tie" VALUE="or">


© 1996-2003 BioPD - University of Padova (Italy) - Author: Leopoldo Saggin - Last version: January 28, 2003
Best efforts were made to provide correct information, however this document may contain technical inaccuracies and/or typographical errors.
The author declares that this material is provided "as is" without any warranty even in the implied warranty of merchantability or fitness for a particular purpose.

All trademarks cited inside this document are property of their respective owners