Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search Widget: Search by Shape Functional but NOT by Attributes #205

Open
drusexton opened this issue Mar 4, 2019 · 2 comments
Open

Search Widget: Search by Shape Functional but NOT by Attributes #205

drusexton opened this issue Mar 4, 2019 · 2 comments

Comments

@drusexton
Copy link

@tmcgee So I am trying to allow the Search Widget to enable Search By Attributes and Search by Shape on more than 1 layer in my map service.

The first layer I was able to get the Search by Attributes and Search by Shape function to work. Therefore I simply copied the code, and changed some layer references. However, the Search by Attributes function is not working, yet the Search by Shape is working.

There is no error message, but I do get a message that says no results were returned from the query. Below is my code, any ideas what might be the issue?

{
                name: 'Water Meters',
                expression: '', // additional where expression applied to all queries
                idProperty: 'objectid',
                labelWidth: 110,
                queryParameters: {
                    type: 'spatial', // spatial, relationship, table or database
                    layerID: 'putnamWater', // from operational layers
                    sublayerID: 2,
                    outFields: ['*']
                },
                infoTemplates: {
                    buffer: {
                        title: 'Search Buffer',
                        content: function (feature) {
                            if (feature.geometry) {
                                return number.format(geometryEngine.geodesicArea(feature.geometry, 'acres'), {
                                    places: 2
                                }) + ' Acres';
                            }
                            return '';
                        }
                    }
                },
                attributeSearches: [
                    {
                        name: 'Search for Meter by ID',
                        searchFields: [
                            {
                                field: 'MeterID',
				label: 'Search by Meter ID',
				placeholder: 'Enter a Meter ID (Example: 533)',
                                required: true,
                                expression: '(MeterID LIKE \'[value]%\')',
                                width: 263,
				minChars: 1
                            }
                        ],
                        title: 'Meter Search Results',
                        topicID: 'metersSearch',
			gridOptions: {
                            columns: [
                                {
                                    field: 'MeterID',
				    label: 'MeterID',
				    sortable: true,
				    resizable: false,
				    width: 150
                                },
                                {
                                    field: 'Join_Meters_Name',
				    label: 'Account holder',
                                    sortable: false,
				    resizable: true,
				    width: 150
                                }
                            ]
                        }
                    }
                ]
	},
	{
                name: 'System Valves',
                expression: '', // additional where expression applied to all queries
                idProperty: 'objectid',
                labelWidth: 110,
                queryParameters: {
                    type: 'spatial', // spatial, relationship, table or database
                    layerID: 'putnamWater', // from operational layers
                    sublayerID: 3,
                    outFields: ['*']
                },
                infoTemplates: {
                    buffer: {
                        title: 'Search Buffer',
                        content: function (feature) {
                            if (feature.geometry) {
                                return number.format(geometryEngine.geodesicArea(feature.geometry, 'acres'), {
                                    places: 2
                                }) + ' Acres';
                            }
                            return '';
                        }
                    }
                },
                attributeSearches: [
                    {
                        name: 'Search for System Valves by ID',
                        searchFields: [
                            {
                                field: 'ValveID',
				label: 'Search by Valve ID',
				placeholder: 'Enter a Valve ID (Example: SV-RIR-1)',
                                required: true,
                                expression: '(ValveID LIKE \'[value]%\')',
                                width: 263,
				minChars: 6
                            }
                        ],
                        title: 'SystemValves',
                        topicID: 'svQuery',
			gridOptions: {
                            columns: [
                                {
                                    field: 'ValveID',
				    label: 'System Valve ID',
				    sortable: true,
				    resizable: true,
				    width: 150
                                },
                                {
                                    field: 'Diameter',
				    label: 'Diameter:',
                                    resizable: true,
				    width: 150
                                }
                            ]
                        }
                    }
                ]
            }
@drusexton
Copy link
Author

drusexton commented Mar 4, 2019

I just wanted to add that the fields being referenced in the layers from the map service are string values, not integer (I changed them per your previous suggestion #203).

@tmcgee
Copy link
Owner

tmcgee commented Mar 8, 2019

@drusexton Sorry, I've been at the Esri Developer Summit. I'll comment on your issue as soon as I can.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants