8. How to Search in Numeric or Date Fields


SFgate allows also the query of two special kind of fields:

  1. DATE FIELDS
  2. NUMERIC FIELDS
In the case of date fields you have a rich choice of formats to input data.
Generally in a specific form you are request for a specific format to use. At the moment no database at BioPD uses this feature.
However, in the figure below all kind of possible formats are reported.




In the case of numeric fields you can query for values: All these numeric predicates can be choosen from a drop-down list

Please note that also fractional number and negative numbers are allowed. Forms can be made in such a way that the same numeric or date field can be searched more than once so that a search for a range of numeric values or dates can be made.

A LIVE example is reported below.

Fields Group 1
Fields Group 2

Here you can inspect 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="local//usr/local/wais-sources/telethon/telethon">

<CENTER>
<TABLE BORDER WIDTH=70%>
   <TR><TH> </TH><TH>
       <TABLE WIDTH="100%">             
          <TR><TH COLSPAN=3 align=left><FONT SIZE="+2">Fields Group 1</FONT></TH></TR>
          <TR><TD><SELECT NAME="fieldsel_1_description">
                    <OPTION SELECTED>Title of the Project
                    <OPTION>Investigator
                    <OPTION>Department
                    <OPTION>City
                    <OPTION>Classification of the Project
                    <OPTION>Grant
                   </SELECT></TD>
              <TD><INPUT TYPE="text" NAME="fieldsel_1_content" SIZE=40></TD>

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

          <TR><TD><SELECT NAME="fieldsel_2_description">
                    <OPTION>Title of the Project
                    <OPTION SELECTED>Investigator
                    <OPTION>Department
                    <OPTION>City
                    <OPTION>Classification of the Project
                    <OPTION>Grant
                   </SELECT></TD>
              <TD WIDTH=50%><INPUT TYPE="text" NAME="fieldsel_2_content" SIZE=40></TD></TR>
       </TABLE>   

<TR><TD>
    <SELECT NAME="group_2_tie">
            <OPTION>and
            <OPTION>or
    </SELECT>
</TD></TR>
<TR><TH> </TH><TH>
        <TABLE ALIGN=left>             
          <TR><TH COLSPAN=4 align=left><FONT SIZE=+2>Fields Group 2</FONT></TH></TR>
          <TR><TD><SELECT NAME="fieldsel_3_description">
                    <OPTION>Time Extension
                    <OPTION>Renewals
                    <OPTION SELECTED>Financial Support
                   </SELECT></TD>

              <TD><SELECT NAME="fieldsel_3_p">
                    <OPTION> &gt;
                    <OPTION SELECTED> &gt;=
                    <OPTION> ==
                    <OPTION> &lt;=
                    <OPTION> &lt;
                  </SELECT></TD>

              <TD><INPUT TYPE="text" NAME="fieldsel_3_content" VALUE="300" SIZE=3 MAXLENGHT=3></TD>

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


          <TR><TD><SELECT NAME="fieldsel_4_description">
                    <OPTION>Time Extension
                    <OPTION>Renewals
                    <OPTION SELECTED>Financial Support 
                  </SELECT></TD>

              <TD><SELECT NAME="fieldsel_4_p">
                    <OPTION> &gt;
                    <OPTION> &gt;=
                    <OPTION> ==
                    <OPTION> &lt;=
                    <OPTION SELECTED> &lt;
                  </SELECT></TD>
        
               <TD COLSPAN=2><INPUT TYPE="text" NAME="fieldsel_4_content" VALUE="800" SIZE=3 MAXLENGHT=3></TD></TR>
        </TABLE>
    </TH></TR>
</TABLE>   
</CENTER>
<P>

<INPUT TYPE="hidden" NAME="fieldsel_name_title" VALUE="Title of the Project">
<INPUT TYPE="hidden" NAME="fieldsel_name_investigator" VALUE="Investigator">
<INPUT TYPE="hidden" NAME="fieldsel_name_department" VALUE="Department">
<INPUT TYPE="hidden" NAME="fieldsel_name_city" VALUE="City">
<INPUT TYPE="hidden" NAME="fieldsel_name_classification" VALUE="Classification of the Project">
<INPUT TYPE="hidden" NAME="fieldsel_name_grant" VALUE="Grant">
<INPUT TYPE="hidden" NAME="fieldsel_name_timeext" VALUE="Time Extension">
<INPUT TYPE="hidden" NAME="fieldsel_name_renewals" VALUE="Renewals">
<INPUT TYPE="hidden" NAME="fieldsel_name_amount" VALUE="Financial Support">

<INPUT TYPE="hidden" NAME="group_1" VALUE="fieldsel_1, fieldsel_2">
<INPUT TYPE="hidden" NAME="group_2" VALUE="fieldsel_3, fieldsel_4">

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

<INPUT TYPE="hidden" NAME="tieinternal" VALUE="and">
<INPUT TYPE="hidden" NAME="application" VALUE="projects">
<INPUT TYPE="hidden" NAME="convert" VALUE="Table">
<INPUT TYPE="hidden" NAME="listenv" VALUE="table">
<INPUT TYPE="hidden" NAME="range" VALUE="1">
</FORM>

In particular note how the predicate is used, for example in this case:

              <TD><SELECT NAME="fieldsel_3_p">
                    <OPTION> &gt;
                    <OPTION SELECTED> &gt;=
                    <OPTION> ==
                    <OPTION> &lt;=
                    <OPTION> &lt;
                  </SELECT></TD>



THIS PAGE REFERENCES:
© 1996-97 BioPD - University of Padova - Author: Leopoldo Saggin
Mail to: lsaggin@civ.bio.unipd.it - Last Revision: August 21, 1997
Tested on Netscape 1.22 and higher