Select to view content in your preferred language

Enhanced Search Widget - Searching Multiple Fields

4442
14
Jump to solution
06-25-2012 09:54 AM
ionarawilson1
Deactivated User
Hi Robert,

I decided to start a new thread as you answered the question I was having  before. But now I need to start working on my own service and I need to ask you something about searching multiple fields. In the case of my website (see link below) I want the user to be able to search one field or many fields at the same time. So if the user decides to search all fields - Company (text input), county (dropdown), primary business (dropdown), major product (dropdown) and major species (dropdown), or just two or three of these fields, how can I change that on the xml or do I need to change the code on the mxml also?

http://tfsfrd.tamu.edu/fpd/fpdtx.asp

Thank you for all your help! I appreciate it!
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus
Ionara,

   Currently the way the widget is setup it expects that all fields specified in the xml will have entries from the user before the search is executed. So you have two possibilities:

  1. Change the code in the mxml. In the function queryFeaturesText there is a area of the code that checks that all inputs have data and if so then the variable isAllInputsfilled is set to true and the search is allowed to execute.

  2. Or you could setup a different expression for each combination of entries (not very practicle but would not require and code change).

View solution in original post

0 Kudos
14 Replies
RobertScheitlin__GISP
MVP Emeritus
Ionara,

   Currently the way the widget is setup it expects that all fields specified in the xml will have entries from the user before the search is executed. So you have two possibilities:

  1. Change the code in the mxml. In the function queryFeaturesText there is a area of the code that checks that all inputs have data and if so then the variable isAllInputsfilled is set to true and the search is allowed to execute.

  2. Or you could setup a different expression for each combination of entries (not very practicle but would not require and code change).

0 Kudos
ionarawilson1
Deactivated User
Thank you Robert. I will try the first idea first!!! Thanks!
0 Kudos
ionarawilson1
Deactivated User
Robert, why on the enhanced search widget I can't make the graphic tools work? For example, I draw a polygon and it does not select anything. However if I use the search widget it works. I thought it was something I was doing but when I tried the link on the esri page the same problems happened.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Ionara,

  You are likely forgetting to click the search button if you have the "enable multi-part graphics" checked.
0 Kudos
ionarawilson1
Deactivated User
Actually it works when I click search when I run from Flash Builder but not from the link at

http://gis.calhouncounty.org/FlexViewer3.0/index.html?config=config-eSearch.xml&search=2&slayer=4&ex...


Do you know why?
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Ionara,

   Still likely your error. If you are using that url it zooms you to my county and when you switch to the graphical search the first layer is Louisville Zoning (well those are in Kentucky not Alabama) so you will not get any results unless you change the graphical search layers to Road centerlines (which are in Alabama).
0 Kudos
ionarawilson1
Deactivated User
It makes sense. Thanks! Still trying to figure out how to query multiple fields....
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Ionara,

  I have an example of querying multiple fields in the SearchWidget.xml that comes in the download:

        <layer>
            <definitionexpression></definitionexpression>
            <enableexport>true</enableexport>
            <name>Road Centerlines</name>
            <url>http://gis.calhouncounty.org/ArcGIS/rest/services/Highway/MapServer/5</url>
            <expressions>
                <expression alias="Road Name and Zip" textsearchlabel="Search by Road Name and Left Zipcode and Right Zip:">
                    <values>
                        <value prompt="Exmaple: ANDREW">RD_NAME = '[value]'</value>
                        <value prompt="Exmaple: 36201">AND ZIP_L = [value]</value>
                        <value prompt="Exmaple: 36201">AND ZIP_R = [value]</value>
                    </values>
                </expression>
                <expression alias="Road Surface" textsearchlabel="Search by Surface Type:">
                    <values>
                        <value prompt="Example: Asphalt" field="Surf_Type" usedomain="true">Surf_Type = '[value]'</value>
                    </values>
                </expression>
                <expression alias="Open SQL" textsearchlabel="Search by Typing Full SQL:">
                    <values>
                        <value prompt="Exmaple: RD_NAME = 'ANDREW' AND ZIP_L = 36201">[value]</value>
                    </values>
                </expression>
            </expressions>
0 Kudos
ionarawilson1
Deactivated User
Thank you for the tip Robert. I will post a new thread if I get stuck!! Thanks!
0 Kudos