Select to view content in your preferred language

Search widget results not showing up in 3.1 attribute table

4862
18
01-17-2013 12:31 PM
JasonHarshman
Occasional Contributor
I've checked the box for "Add results as operational layer", and as expected, the results from a search are shown in the legend, layer list, and a tab is added for the results layer in the attribute table. However, the attribute table is blank with no records or fields. The results in the search widget are visible and there parcels selected. I've attached a screenshot to help illustrating what I'm experiencing.

[ATTACH=CONFIG]20817[/ATTACH]
Tags (2)
0 Kudos
18 Replies
JasonHarshman
Occasional Contributor
config code below:

<?xml version="1.0" ?>
<configuration>
    <zoomscale>50000</zoomscale>
    <shareresults>true</shareresults>
    <layers>
        <layer>
            <name>Parcels</name>
            <url>http://services.arcgis.com/wgcHnVlNZ7zk98J7/arcgis/rest/services/ECP_New_Parcels/FeatureServer/0</url>
            <expression>AsmtNum = '[value]'</expression>
            <textsearchlabel>Search by Parcel Number</textsearchlabel>
            <titlefield>AsmtNum</titlefield>
            <fields>
                <field name="AsmtNum" alias="AsmtNum"/>
                <field name="Zoning" alias="Zoning"/>
                <field name="LUD" alias="LUD"/>
                <field name="ParcelType" alias="ParcelType"/>
                <field name="CalcAcres" alias="CalcAcres"/>
                <field name="Owner_Firs" alias="Owner_Firs"/>
                <field name="Owner_MI" alias="Owner_MI"/>
                <field name="Owner_Last" alias="Owner_Last"/>
                <field name="AssesseeNa" alias="AssesseeNa"/>
                <field name="Mailing_St" alias="Mailing_St"/>
                <field name="Mailing_Ci" alias="Mailing_Ci"/>
                <field name="Mailing__1" alias="Mailing__1"/>
                <field name="Mailing_Zi" alias="Mailing_Zi"/>
                <field name="Mailing_Ad" alias="Mailing_Ad"/>
                <field name="LandValue" alias="LandValue"/>
                <field name="ImprValue" alias="ImprValue"/>
            </fields>
            <orderbyfields>AsmtNum</orderbyfields>
        </layer>
    </layers>
</configuration>
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Anthony,


Just add
<shareresults>true</shareresults>
They seem to have missed this in the Widgets Tag References in the docs.
0 Kudos
AnthonyGiles
Frequent Contributor II
Robert,

Have you also migrated this change over to your enhanced search widget?

Regards

Anthony
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Antony,

   No I don't want the results to show up in the layerlist or the toc so I add hiddenLayer_ to the FeatureLayers name.
0 Kudos
SarthakDatt
Occasional Contributor III
Hey Jason,

The reason its not showing anything in the AT widget is because Attribute Table component is not able to create the columns. The Search widget should set the outfields on the (result)feature layer for that to happen, otherwise it just shows the 'displayfield'. My guess is your service does not have a display field set, hence you see nothing.

Quick fix for this would be to update the SearchWidget.mxml by adding:

private function createSearchResults(featureSet:FeatureSet, queryFields:XMLList):ArrayCollection
            {
                var result:ArrayCollection = new ArrayCollection();

                var layerDetails:LayerDetails = queryLayer.layerDetails;
                if (!queryTitleField)
                {
                    queryTitleField = featureSet.displayFieldName;
                }

                for each (var graphic:Graphic in featureSet.features)
                {   
                    var resultAttributes:ResultAttributes =
                        ResultAttributes.toResultAttributes(queryFields, textDirection, graphic, featureSet, queryLayer, layerDetails, widgetTitle, queryTitleField, queryLinkField, queryLinkAlias);

                    var searchResult:ResultItem = new ResultItem(graphic, resultAttributes);
                    result.addItem(searchResult);

                    var infoWindowRenderer:ClassFactory = new ClassFactory(PopUpRenderer);
                    infoWindowRenderer.properties = { popUpInfo: configurePopUpInfo(resultAttributes)};
                    graphic.infoWindowRenderer = infoWindowRenderer;
                }
                resultFeatureLayer.outFields = queryLayer.outFields; // for Attribute Table and/or AttributeInspector
                resultFeatureLayer.visible = true;
                resultFeatureLayer.featureCollection = new FeatureCollection(featureSet, layerDetails);
                switch (featureSet.geometryType)
                {
                    case Geometry.MAPPOINT:
                    {
                        resultFeatureLayer.renderer = new SimpleRenderer(resultMarkerSymbol);
                        break;
                    }
                    case Geometry.POLYLINE:
                    {
                        resultFeatureLayer.renderer = new SimpleRenderer(resultLineSymbol);
                        break;
                    }
                    case Geometry.POLYGON:
                    {
                        resultFeatureLayer.renderer = new SimpleRenderer(resultFillSymbol);
                        break;
                    }
                }

                return result;
            }
0 Kudos
KennyHoran
New Contributor III
Thanks Sarthak, I had the exact same problem and that fixed it.  I hope that'll be included in the next release.
0 Kudos
JasonHarshman
Occasional Contributor
How do I set a display field for the service so I don't have to edit the mxml?

Or, how do I compile the revised mxml back to a .swf? I was able to get the source code for the searchwidget.mxml off of github, but now I don't know how to get it to widget form.

Thanks!
0 Kudos
JasonHarshman
Occasional Contributor
I was able to figure it out. It took downloading the entire flexviewer zip from hithub, but it worked. I did notice the individual mxml file on hithub does not have that line of code, https://github.com/Esri/arcgis-viewer-flex/blob/master/src/widgets/Search/SearchWidget.mxml, but it is included in the flexviewer zip. Oh well. Hopefully it's included in the 3.2 release.
0 Kudos
BjornSvensson
Esri Regular Contributor
Just wanted to follow up and let you know that this has been fixed and will be part of the 3.2 release (see GitHub Issue #22).

FYI: if you want to see what other viewer code changes made it into 3.2, look at the 58 closed and verified issues for 3.2:
https://github.com/Esri/arcgis-viewer-flex/issues?labels=verified&milestone=1&state=closed
0 Kudos