Select to view content in your preferred language

Query Widget - Filter Results

3955
11
Jump to solution
07-02-2013 02:33 PM
GavinMayeda
Deactivated User
Ok, I have become completely lost trying to configure the Query widget.  The basic set-up I grasp, but in the help section it shows the Louisville Police Query widget with a 'Filter results' and 'Show all' feature.

Bluntly, how do I do this????  I have tried the sample code, and that does not give me the results that I am looking for.

I would like to query the data that I have already assembled, and the output is very straightforward.  I would like to query by an existing field, have it return all results for that field, and then have the user be able to narrow the results to a single specific value.

As always, any and all help is sincerely appreciated!!
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
GavinMayeda
Deactivated User
The filter results seems to have been a bug in version 3.0.  After upgrading to version 3.4 the problem with returning results from all fields instead of the original query field no longer happens.

I hope that this helps anyone that was having the same problem!

View solution in original post

0 Kudos
11 Replies
AnthonyGiles
Honored Contributor
Gavin,

All you have to do is put the field name you want to perform the filter against in the <filterfield><name> area, this will take the user input value and find matches anywhere in the field (essentially doing a LIKE '%value%'):

<configuration>
 <layer>Your service URL</layer>
 <titlefield>PD_NAME</titlefield>
 <fields all="false">
  <field name="PD_NAME"/>
  <field name="ADDRESS" alias="Address"/>
 </fields>
 <filterfield>
    <name>yourfieldname</name>
    <alias>text you want to appear above user input</alias>
    </filterfield>
  <linkfield></linkfield>
  <refreshrate></refreshrate>
  <zoomscale>20000</zoomscale>
  <query>1=1</query>
</configuration>


regards

Anthony
0 Kudos
GavinMayeda
Deactivated User
Anthony,

Thank you so much for the explanation, it helped tremendously. 

I have a question though.  Is the query limited to a certain number of results?  The query is running against 167,000 plus records and is only displaying a result of 1000.  I can't really tell where the selection is, but it definitely isn't county wide.

If it will only return a limited amount of results, this probably will not work in the situation that I am trying to use it in.

Thank you again for the reply!!
0 Kudos
GISDev1
Deactivated User
Anthony,

Thank you so much for the explanation, it helped tremendously. 

I have a question though.  Is the query limited to a certain number of results?  The query is running against 167,000 plus records and is only displaying a result of 1000.  I can't really tell where the selection is, but it definitely isn't county wide.

If it will only return a limited amount of results, this probably will not work in the situation that I am trying to use it in.

Thank you again for the reply!!


That 1,000 limit is on the ArcGIS Server side. You will see that option for max. results while publishing your REST Service.
0 Kudos
AnthonyGiles
Honored Contributor
Gavin,

The number of results returned from a service is set in the properties of the service when you publish it, on a 10.1 server this has a default value of 1000.

http://resources.arcgis.com/en/help/main/10.1/index.html#/Setting_map_service_properties/0154000003p...

You can push this number up but you may find it slows your service down. I would guess that 167,000 points will be far to many.

If you want to be able to search against a large data set you may be better off creating a geocode service:

http://resources.arcgis.com/en/help/main/10.1/index.html#/Geocode_services/01540000035t000000/

Regards

Anthony
0 Kudos
GavinMayeda
Deactivated User
Anthony,

Thank you for all of your help!  The script is working fairly well, but for some reason when I use the filter it seems to be pulling data from all fields rather than the specified field.

For example, filtering a Group Code of 4105 from the initial query will return all matches from the Group Code field, it will also return the value of 4105 from all other fields as well.  Is it possible to narrow the filter to using strictly the Group Code field?

Thank you,

Gavin Mayeda
0 Kudos
MaisarahAbdulHalim
Occasional Contributor
Gavin,

The number of results returned from a service is set in the properties of the service when you publish it, on a 10.1 server this has a default value of 1000.

http://resources.arcgis.com/en/help/main/10.1/index.html#/Setting_map_service_properties/0154000003p...

You can push this number up but you may find it slows your service down. I would guess that 167,000 points will be far to many.

Anthony


Sorry to interrupt,

I have set it to 30,000 and it really is slowing down or crashing my Flex application! 😞

This returning results default value of 1000 applies to all widgets or just this one?

Thanks
0 Kudos
AnthonyGiles
Honored Contributor
Maisarah,

The value applies to service not to a particular widget,

Regards

Anthony
0 Kudos
MaisarahAbdulHalim
Occasional Contributor
I mean, using other widget using the same map service set at 1000,
For example..Will a search widget return 1000 results as well?  what about enhanced search widget?
0 Kudos
AnthonyGiles
Honored Contributor
Yes, as the setting is on the service, any widget using that service will use the max number of features that has been set

Regards

Anthony
0 Kudos