Enhanced-Search-Widget-for-FlexViewer Part III

116383
776
04-30-2013 03:58 PM
RobertScheitlin__GISP
MVP Emeritus
All,

   Here is a new thread to post questions and discuss the Enhanched Search Widget. The old thread was getting too long.
Tags (2)
776 Replies
RobertScheitlin__GISP
MVP Emeritus
Jay,

   They must have done something in 10.2 to not allow the SQL command 'replace'. I have never used the 'replace' command in my SQL statements so can't be much help. If you are using the source code than you can do this same thing in the code though.
0 Kudos
JayGeisen
New Contributor III
Thanks, Robert. I am using the source. Care to point me in the right direction, by chance?
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Jay,

   Sure, in the eSearchWidget.mxml find the queryFeaturesText function, then look for the block of code like this and add the lines in red:

                if(queryLayer){
                    var query:Query = new Query();
                    var myPattern:RegExp = /\[value\]/g;
                    var expr:String = "";
                    var eVal:String = "";
                    var criteriaFromValue:String;

                    for(var sg:Number = 0; sg < searchGroup.numElements; sg++){
                        sItemVal = searchGroup.getElementAt(sg) as SearchExpValueItem;
                        queryExpr = configSearchText.expr.values[sg].expression;

                        if (queryExpr == "[value]" || queryExpr.toLowerCase().indexOf(" in (") > 0){
                            //meaning an open SQL expression or an SQL with an IN Statement
                            eVal = sItemVal.textValue;
                        }else{
                            eVal = sItemVal.textValue.replace(/'/g,"''");
                        };
                        /*If the expression is an IN Statement and the the value is a string then
                        replace the user defines comma seperated values with single quoted values*/
                        if(queryExpr.toLowerCase().indexOf(" in (") > 0 && queryExpr.toLowerCase().indexOf("'[value]'") > -1){
                            //replace the begining and trailing single qoutes if they exist
                            eVal = eVal.replace(/^'|'$/g, "").replace(/,|','/g, "','");
                        }
                        if (sItemVal.isValueRequired && !sItemVal.hasAValue()){
                            // no value specified so skip this part of where clause
                            continue;
                        };
                        
                        if (queryExpr == "ADDRESS LIKE '[value]%' OR STREET LIKE '%[value]%'"){
                            queryExpr = "ADDRESS LIKE '" + eVal.replace(" ", "%") + "%' OR STREET LIKE '%[value]%'";
                        }
0 Kudos
JustinConner
Occasional Contributor II
Does anyone know if this problem is fixed in version 3.5? It pretty much stopped my upgrade to 3.4 and I really would like to update soon.

Found a problem. I've got your latest eSearch version and it works great. One problem though is with printing. When printing a parcel that is highlighted using the new print widget the graphic doesn't maintain it's transparency. It works when using the ESRI search widget however.
[ATTACH=CONFIG]25752[/ATTACH] [ATTACH=CONFIG]25753[/ATTACH]
If you want to see for yourself you can view the app at http://gis.co.wood.wi.us/Flex34/index.html

0 Kudos
ChadHall
New Contributor
Chad,

   Hmm... You have me wondering what you are talking about exactly, because the graphical serach portion of the widget will buffer a point, polyline, rect, or polygon that you draw. The Spatial Search will buffer what ever type of layer geometry you have have selected based on a text or graphical search run earlier...


Sorry for the delayed response Robert (I was out on vacation) and thank you for your reply.  Maybe this will clarify.  I see where I can show a buffer distance of a selected feature.  Is there a way for this buffer to "grab" the polygons the buffer touches and add them to the results window?  I can manually trace a polygon and essentially do the operation that way but I was hoping to simplify the process for the end user with only a couple clicks at most.

Again, sorry for the late response and thank you again for your help!
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Chad,

   Hmm... What I am understanding you to be asking is very possible using the SPATIAL search portion of the widget, or maybe I am just not understanding you.

When you use the graphical or text search to select your original polygon then you switch to the Spatial search portion and specify a buffer distance and search layer and the polygons (assuming that is the search layer you choose) that intersect the buffer get selected and added to the results. Based on this explanation am I still missing your question?
0 Kudos
ChadHall
New Contributor
You have it correct.  I wasn't using your widget correctly!  I saw the buttons for entirely contained or intersect or envelope and didn't realize you could click that to select the buffer graphic features.  Sorry for that; I should've at least attempted to do that before garnering your attentions.

Any idea about the parent/child box checking comment from earlier?

Thank for you putting up with me!!
0 Kudos
ChadHall
New Contributor
Call me needy but I've been battling this and don't see it.  I've read the help file and I'm not finding it there either and I hate to be a bother.  The "Owner Name" search is working correctly but the "Property ID" search is not.  I thought I've changed it appropriately since it's a numeric field and not a text field but I keep getting an error when I try to process the request.  Code's below unless you need more of the block.  Good news is the graphical search and buffer issues are gone so I'm almost there.

<expressions>
<expression alias="Owner Name" textsearchlabel="Search Owner Name [ Example: PUBLIC JOHN Q ]:">
  <values>
   <value prompt="Example: PUBLIC JOHN Q" isvaluerequired="true">upper(file_as_na) LIKE upper('%[value]%')</value>
  </values>
</expression>
<expression alias="Property ID" textsearchlabel="Search Property ID [ Example: 52138 ]:">
  <values>
   <value prompt="Example: 52138" isvaluerequired="true">PROP_ID = '[value]'</value>
  </values>
</expression>
</expressions>
0 Kudos
ChrisNorth
Esri Contributor
Folks,

I'm stumped.  I'm using the eSearch Widget to search a layer with a related table (the features are wells, the related records samples).  The relationship class works fine - in the info PopUp the related records appear.

The eSearch Widget works for searching the features, but as soon as I click on the icon to show related records, I get odd behaviour.

- If the floating Data Grid is used, the mouse cursor turns into the "clock" and nothing happens.
- If the Fixed data great is used, then the "Related Results" tab shows up, but it's blank (no data, no rows, no columns). And, I also get the "clock cursor".

The REST endpoint of my service is...
http://54.235.15.249/arcgis/rest/services/MoE/MoEOperationalSDE/MapServer/9

There is indeed a relationship on that layer (ID:1).

Pertinant part of the widget configuration is...
<relates>
<relate id="1" label="Related PGMN Samples 2010" enableexport="true"
      icon="widgets/FortyThree/Search/assets/images/i_relate.png"
      enableprintgrid="true" printitle="Related PGMN Samples 2010">
  <fields all="true"/>
   <zoomscale usegeometry="true" zoompercent="1.6" />
  </relate>
</relates>

I've added the fixed DG MXML module to the project (I'm using the source).

Thoughts?
Chris
0 Kudos
ChrisNorth
Esri Contributor
Call me needy but I've been battling this and don't see it.  I've read the help file and I'm not finding it there either and I hate to be a bother.  The "Owner Name" search is working correctly but the "Property ID" search is not.  I thought I've changed it appropriately since it's a numeric field and not a text field but I keep getting an error when I try to process the request.  Code's below unless you need more of the block.  Good news is the graphical search and buffer issues are gone so I'm almost there.

<expressions>
<expression alias="Owner Name" textsearchlabel="Search Owner Name [ Example: PUBLIC JOHN Q ]:">
  <values>
   <value prompt="Example: PUBLIC JOHN Q" isvaluerequired="true">upper(file_as_na) LIKE upper('%[value]%')</value>
  </values>
</expression>
<expression alias="Property ID" textsearchlabel="Search Property ID [ Example: 52138 ]:">
  <values>
   <value prompt="Example: 52138" isvaluerequired="true">PROP_ID = '[value]'</value>
  </values>
</expression>
</expressions>


Question - what is the data type of your PROP_ID field?  You have single quotes around [value] which implies a string. If a string, then you should use the "upper" and "like" syntax as with owner name search.

If the PROP_ID is a number, then I think you have to get rid of the quotes.
0 Kudos