Select to view content in your preferred language

Enhanced Search Widget for FlexViewer 2.1

158151
767
10-25-2010 02:13 PM
RobertScheitlin__GISP
MVP Emeritus
All Here is my next widget in the FlexViewer 2.1 series

Special thanks to Erwan Caradec for contributing to this code.

The Enhanced Search Widget extends the standard search widget with a floating data grid and a new spatial query w/buffering.

http://www.arcgis.com/home/item.html?id=5d4995ccdb99429185dfd8d8fb2a513e
Tags (2)
0 Kudos
767 Replies
NathanEnge
Esri Contributor
Robert, is there any possibility to either specify coded values as dropdown in the config.xml to show in the text search?

or search through the recordset for unique values at the mxml level and populate a dropdown box in the text search?
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Nathan,

   Are you wanting to specify your own list of values in the xml file?.. Because right now you can use a field that has a coded value domain and it will add a combobox with the domains values if you specify usedomain="true". If you are wanting to manually add values than I will add that to the requested enhancements list but don't see this happening very soon (just to busy).
0 Kudos
deleted-user-RjoC4IOGTpoH
Deactivated User
Good afternoon Robert.

I hope you are doing well.

Just a request for a future enhancement to the widget. I believe I may have asked this before.

Would it be possible to add the option for the sum of select columns to be displayed in the floating datagrid at the bottom by including the field names in the xml file?

Currently the users have to export each time to calculate them.
Something to consider for a future enhacement if possible.

Thanks again ...

Nestor.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Nestor,

   Version 2.2.9 how has this ability.
0 Kudos
deleted-user-RjoC4IOGTpoH
Deactivated User
Nestor,

   Version 2.2.9 how has this ability.


Fantastic Robert !!

You just made a lot of users happy including me.

Thank You very much.

Nestor.
0 Kudos
MarcWeinshenker1
Regular Contributor
Nestor,

   Version 2.2.9 how has this ability.


Robert,

The sum function seems to have been put in for text queries but not for graphical queries.  I see sum data accounted for in the function queryFeaturesText but not in the function queryFeaturesGraphical.  Is there a problem which prohibits summing the results of a graphical query?  I'd like to be able to graphically choose a number of parcels and then sum the area, for instance.

Thanks,
Marc
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Marc,

Hmm... On my live test site it does sum a graphical search if you have more than one record selected using the graphical search.

EDIT:
Well I now see the issue. If you don't do a text search first that shows the sum box than it will not appear in the graphical...

I'm on it...
0 Kudos
MarcWeinshenker1
Regular Contributor
Marc, 

Hmm... On my live test site it does sum a graphical search if you have more than one record selected using the graphical search. 

EDIT:
Well I now see the issue. If you don't do a text search first that shows the sum box than it will not appear in the graphical...


I'm on it...


Robert,

I wasn't using the text search at all, and now that I try doing that first I am seeing the graphical total. Thanks for figuring it out.

Marc
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
All,

   Version 2.2.10 is now available. This version has a minor fix and a new document that describes all the needed code changes to make this widget run a search from the URL.

Maybe the last version until 2.2.3 as I am Beta testing the 2.3 FlexViewer right now.
0 Kudos
WillHughes1
Frequent Contributor
Robert,

I was successful adding a 2-variable search capability to the default Search widget, and now I am trying to do the same thing for the eSearch widget. I added a cbo box to the widget which is used as a picklist to choose the 2nd search variable (values are hard coded in the SearchWidget.mxml code).
The fault error is: fault code 400, unable to perform query, check your parameters.
Do you see anything I am doing wrong in the code below?
Thanks.
Awesome widget by the way.

Will

SearchWidget.xml (code piece)
<layer>
   <enableexport>true</enableexport>
            <name>Facilities</name>
            <url>http://mywebserver/rest/services/myservicename/MapServer/1</url>
            <expressions>
             <expression alias="Facility Number" textsearchlabel="FACIL_ID [ Example: 1600 ]:">upper(FACIL_ID) = upper('[value]') AND upper(I_ID) = upper('[value2]')</expression>
             <!--<expression alias="Facility Name" textsearchlabel="Facility Name [ Example: City Hall ]:">upper(SNAME) LIKE upper('%[value]%') AND upper(I_ID) = upper('[value2]')</expression>-->
             <!--<expression alias="Zoning Name" textsearchlabel="Search Zoning Name [ Example: RES MULTI-FAMILY ]:">upper(ZONING_NAME) = upper('[value]')</expression>-->
            </expressions>
            <graphicalsearchlabel>Use one of the graphical search tools to select Zoning</graphicalsearchlabel>
   <spatialsearchlayer>true</spatialsearchlayer>
   <titlefield>FACILID</titlefield>
            <linkfield linkprefix="" linksuffix=""></linkfield>
   <icon isfield="true" iconprefix="" iconsuffix=""></icon>
            <fields all="false">
                <field name="FACILID" alias="Facility Id"/>
                <field name="SNAME" alias="Facility Name"/>
                <!--<field name="STR_TYPE_D" alias="Zoning Type"/>-->
            </fields>
        </layer>

SearchWidget.mxml (code piece)
if (configSearchText.useproxy && configData.proxyUrl)
     {
      queryTask.proxyURL = configData.proxyUrl;
     }
     var query:Query = new Query();
     var myPattern:RegExp = /\[value\]/g;
     var myPattern2:RegExp = /\[value2\]/g; //added by W.Hughes - variable for installation code
     var expr:String;
     var exprFinal:String = expr; //added by W.Hughes to add second variable to expression
     if (txtSearch.visible){
      expr = queryExpr.replace(myPattern, txtSearch.text);
      expr = expr.replace(myPattern2, cbo2.text); //variable for installation code
     }else{
      expr = queryExpr.replace(myPattern, cbSearch.selectedItem.value);
     }
     //query.where = expr;  this is the original code
     query.where = exprFinal //added by W.Hughes



and...........


<s:TextInput id="txtSearch" width="90%" enter="queryFeaturesText()"/>
   <mx:ComboBox id="cbo2" width="40%">
    <mx:dataProvider>
     <fx:Array>
      <fx:String>abcd</fx:String>
      <fx:String>efgh</fx:String>
      <fx:String>ijkl</fx:String>
      <fx:String>mnop</fx:String>
      <fx:String>qrst</fx:String>
     </fx:Array>
    </mx:dataProvider>
   </mx:ComboBox>
   <mx:ComboBox id="cbSearch" creationComplete="{cbSearch.width = wTemplate.width - 40; fnInit();}"
       change="queryFeaturesText()" visible="false" includeInLayout="false"
       labelField="label"/>
0 Kudos