Skip to content

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

Open
@drusexton

Description

@drusexton

@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
                                }
                            ]
                        }
                    }
                ]
            }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions