Select to view content in your preferred language

JSON for predefined search

3433
5
10-05-2011 05:33 AM
BradChappell
Emerging Contributor
I'm looking for some JSON examples for a predefined search.  I cannot use ArcGIS Online to configure a search because we must keep everything behind our firewall.

Can anyone help?

Thanks
0 Kudos
5 Replies
RussRoberts
Esri Notable Contributor
here you go, I included just the query tasks. This one has multiple query samples included.
1. is using a coded domain
2. is using a coded domain with a prompt value
3. is similar to the first one.
4. Uses a prompt with edit hint

"tasks": {"queryTasks": [
    {
      "displayField": "description",
      "name": "Facility Query",
      "parameters": [{
        "defaultValue": "6",
        "field": "facility",
        "helpTip": "Dining",
        "operator": "=",
        "prompt": "Facility Type"
      }],
      "url": "http://sampleserver5.arcgisonline.com/ArcGIS/rest/services/LocalGovernment/Recreation/FeatureServer/...",
      "visibleFields": [
        "facility",
        "description",
        "quality",
        "observed"
      ],
      "whereClause": "{0}"
    },
    {
      "displayField": "description",
      "name": "PROMPT",
      "parameters": [{
        "defaultValue": "3",
        "field": "facility",
        "operator": "=",
        "prompt": "enter a value"
      }],
      "url": "http://sampleserver5.arcgisonline.com/ArcGIS/rest/services/LocalGovernment/Recreation/FeatureServer/...",
      "visibleFields": [
        "facility",
        "description",
        "quality",
        "observed"
      ],
      "whereClause": "{0}"
    },
    {
      "displayField": "facility",
      "name": "Basic Query",
      "parameters": [],
      "url": "http://sampleserver5.arcgisonline.com/ArcGIS/rest/services/LocalGovernment/Recreation/FeatureServer/...",
      "visibleFields": [
        "facility",
        "description",
        "quality",
        "observed"
      ],
      "whereClause": "facility = 1"
    },
    {
      "displayField": "facility",
      "name": "Prompt+Edit Hint",
      "parameters": [{
        "defaultValue": "2",
        "field": "facility",
        "helpTip": "Camping",
        "operator": "=",
        "prompt": "Enter Facility Type"
      }],
      "url": "http://sampleserver5.arcgisonline.com/ArcGIS/rest/services/LocalGovernment/Recreation/FeatureServer/...",
      "visibleFields": [
        "facility",
        "description",
        "quality",
        "observed"
      ],
      "whereClause": "{0}"
    }
  ]},
  "version": "1.3"
}
0 Kudos
BradChappell
Emerging Contributor
That did it.  Thanks!

Do you have good documentation for the JSON map configurations?
0 Kudos
RussRoberts
Esri Notable Contributor
We are working on an updated version(1.4 webmap) and I will post a link to the updated doc on the this thread. There is a good forum topic within iOS about definining popups for your layers within your JSON. Also if you have any further questions feel free to post them on this thread directly or create a new one and I will try to answer them quickly for you.
Cheers
Russ
0 Kudos
NickG
by
Emerging Contributor
Is it possible to search multiple fields in the same layer with one search term (prompt)?  Something like the example below?  

"queryTasks": [{
    "displayField": "DisplayField",
    "name": "Search Name",
    "parameters": [{
      "defaultValue": "",
      "prompt": "Enter Something"
    }],
    "url": "http://url to some service layer",
    "visibleFields": [
      "FIELD1",
      "FIELD2",
      "FIELD3"
    ],
    "whereClause": "FIELD1 = {0} or FIELD2 = {0} or FIELD3 = {0}"
  }]
0 Kudos
AliciaSoto
Frequent Contributor
Is there a way to do this?

I'm trying to figure out a way for users to search by street block number.

I have a street layer with these two fields 1) Block Number 2) Street Name

Is it possible to search multiple fields in the same layer with one search term (prompt)?  Something like the example below?  

"queryTasks": [{
    "displayField": "DisplayField",
    "name": "Search Name",
    "parameters": [{
      "defaultValue": "",
      "prompt": "Enter Something"
    }],
    "url": "http://url to some service layer",
    "visibleFields": [
      "FIELD1",
      "FIELD2",
      "FIELD3"
    ],
    "whereClause": "FIELD1 = {0} or FIELD2 = {0} or FIELD3 = {0}"
  }]
0 Kudos