Select to view content in your preferred language

Regular search widget default to text search

1625
11
12-13-2010 06:53 AM
by Anonymous User
Not applicable
Original User: alnesbit

Hello,

In the ESRI search widget 2.1 or 2.2, is there anyway to tell it to default to a text search? Most users would not have a clue what the graphic symbols are for or that they should click the little icon to change to a text search. I would think a text search would be the most used kind of search in general.

Thanks,
0 Kudos
11 Replies
RobertScheitlin__GISP
MVP Emeritus
Andrea,

Not until you start using the source code then you can do this

<viewer:BaseWidget xmlns:esri="http://www.esri.com/2008/ags"
                   xmlns:fx="http://ns.adobe.com/mxml/2009"
                   xmlns:s="library://ns.adobe.com/flex/spark"
                   xmlns:mx="library://ns.adobe.com/flex/mx"
                   xmlns:Search="widgets.Search.*"
                   xmlns:viewer="com.esri.viewer.*"
                   x="600" y="300"
                   widgetConfigLoaded="init()" currentState="textInput">
0 Kudos
by Anonymous User
Not applicable
Original User: patovar55

i have a quick question,
the search field for the Search Widget finds matches in the parcel data that are integer based.  My data has a string i need it to search, when i switch the field to look in this field it doesn't work but when i change it to a field that is an integer type then it does.
how do i switch it so that it works with string type fields as well?
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Paolo,

   Post Your SearchWidget.xml.
0 Kudos
by Anonymous User
Not applicable
Original User: patovar55

here you go:

<?xml version="1.0" ?>
<configuration>
    <layers>
        <layer>
            <name>Parcels</name>
            <url>http://ptovar-pc/ArcGISServer/rest/services/TEST/Parcels/FeatureServer/0</url>
            <expression>AssessorNum_diss = '[value]'</expression>
            <textsearchlabel>Search by Parcel ID  [ Example: L18100149000 ]:</textsearchlabel>
            <titlefield>AssessorNum_diss</titlefield>
            <linkfield></linkfield>
            <fields all = "true">
                <field name="AssessorNum_diss"/>
            </fields>
        </layer>
    </layers>
    <zoomscale>5000</zoomscale>
    <info>widgets/InfoTemplates/InfoPopupWidget.swf</info>
</configuration>

thank you
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Paolo,

   SO this here is a string sql expression:
<expression>AssessorNum_diss = '[value]'</expression>

This would be an numeric expression:
<expression>AssessorNum_diss = [value]</expression>
0 Kudos
by Anonymous User
Not applicable
Original User: patovar55

Thanks for the quick response.

My original code had the single quotes thus it should have worked. Wait i understand what is going.
I was searching for a part of the string and it gave me the attached error.  But when i put in the complete and exact text it works.  I tried using this
<expression>AssessorNum_diss = '%[value]%'</expression>
and this
<expression>AssessorNum_diss = '*[value]*'</expression>

and it doesn't seem to do a partial search match return.
This this simple to fix?

Thanks for your help
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Paolo,

   Wild cards can not be used in the expression without the like operator

<expression>AssessorNum_diss LIKE '%[value]%'</expression>


If you also want the query to be non case sensitive then use:
<expression>Upper(AssessorNum_diss) LIKE Upper('%[value]%')</expression>
0 Kudos
by Anonymous User
Not applicable
Original User: patovar55

Thank you So Much,
I've learned a valuable lesson that the <expression> block is the same as the expression in ArcGIS.   I thought I was working with a Flex expression.

Cheers!
0 Kudos
by Anonymous User
Not applicable
Original User: alnesbit

Andrea, 

Not until you start using the source code then you can do this 

<viewer:BaseWidget xmlns:esri="http://www.esri.com/2008/ags"
                   xmlns:fx="http://ns.adobe.com/mxml/2009"
                   xmlns:s="library://ns.adobe.com/flex/spark"
                   xmlns:mx="library://ns.adobe.com/flex/mx"
                   xmlns:Search="widgets.Search.*"
                   xmlns:viewer="com.esri.viewer.*"
                   x="600" y="300"
                   widgetConfigLoaded="init()" currentState="textInput">


Robert,

Yes, you're right. That does work. However, the search box still shows the little underline under the graphic search so it's confusing. Is there a way in the code to tell it to also put the underline under the text search instead of the graphic search?

Thanks. New to the coding part of it,
0 Kudos