Skip to main content

VSW5.28.1: How to search a particular feature based on one field?

Comments

5 comments

  • Ryan Kelley

    Hi Lubna, here is a very simple workflow that loads a list of counties, and zoom the map to the one selected. The services used are public facing, so should work as-is in your app, to test. You'd just need to replace our services with yours, modify your queries, etc.

    Copy this syntax to notepad and save as a .json file, then upload that to Workflow using File > Import and save:

    {"_properties":{"isServerWorkflow":false},"components":[{"id":2,"steps":[{"id":3,"inputs":{},"position":"710,-70","purpose":"start","title":"Start","transitions":[{"id":1248,"inputs":{},"position":"800,-10 800,70 820,70 820,90","sourceConnector":"bottom","target":{"id":1151},"targetConnector":"top"}]},{"action":"gcx:wf:app::GetApplicationData","id":1151,"inputs":{"key":"keyExternalValue_A"},"name":"getApplicationData1","position":"700,90","title":"Get Application Data","transitions":[{"id":1241,"inputs":{},"position":"820,160 820,180 920,180 920,200","sourceConnector":"bottom","target":{"id":1183},"targetConnector":"top"}]},{"action":"gcx:wf:core::Annotation","description":"$displayform1.state.radioGroup1.value === 'trsRadioValue'\n\n=$displayform1.state[\"DropDownList2\"].value == nothing","id":1153,"inputs":{},"position":"1060,170","title":"Syntax Notes"},{"action":"gcx:wf:core::Annotation","description":"Cannot \"complete\" the Exit loops, from each of the ZoomTo Containers;  When those are hooked up to Exit, the Input Form closes BEFORE users have a chance to choose anything.","id":1155,"inputs":{},"position":"940,710","title":"Exit Notes"},{"action":"gcx:wf:core::Annotation","description":"County Lookups has issues with Duplicate County Names like Benton.\n\nNeed to change the listing to include the State elements as well.  Will probably take some parsing routines.\n","id":1157,"inputs":{},"position":"1220,630","title":"Future Enhancement Notes"},{"action":"gcx:wf:forms:form:DisplayForm","id":1159,"inputs":{"form":{"accessors":[],"code":"resources.forms[values.id]","values":{"id":1149}}},"name":"displayform1","position":"640,320","title":"Display Form","transitions":[{"id":1223,"inputs":{},"position":"760,440 760,490","sourceConnector":"bottom","target":{"id":1161}}]},{"action":"gcx:wf:core::If","id":1161,"inputs":{"condition":{"accessors":["$displayform1"],"annotations":[{"count":13,"index":0,"kind":"idref"}],"code":"$displayform1.result === \"submit\"","source":"$displayform1.result === \"submit\""}},"position":"700,490","title":"If","transitions":[{"branch":"false","id":1225,"inputs":{},"position":"820,520 960,520 960,610 980,610","sourceConnector":"right","target":{"id":1163}},{"branch":"true","id":1227,"inputs":{},"position":"700,520 320,520 320,545 300,545","sourceConnector":"left","target":{"id":1171},"targetConnector":"right"}]},{"action":"gcx:wf:core::Exit","id":1163,"inputs":{},"position":"980,580","title":"Exit"},{"action":"gcx:wf:core::Container","id":1171,"inputs":{},"position":"60,500","title":"County"},{"action":"gcx:wf:core::CreateValue","description":"https://gis.blm.gov/orarcgis","id":1183,"inputs":{"expression":"https://gis.blm.gov/orarcgis"},"name":"envWS","position":"800,200","title":"Create Value","transitions":[{"id":1221,"inputs":{},"position":"920,300 920,380 880,380","sourceConnector":"bottom","target":{"id":1159},"targetConnector":"right"}]}]},{"id":495,"steps":[{"id":497,"inputs":{},"position":"0,0","purpose":"start","title":"Container","transitions":[{"id":511,"inputs":{},"position":"90,60 90,80 80,80 80,100","target":{"id":499}}]},{"action":"gcx:wf:core::If","id":499,"inputs":{"condition":{"accessors":["$displayform1","nothing"],"annotations":[{"count":13,"index":0,"kind":"idref"},{"count":7,"index":47,"kind":"idref"}],"code":"$displayform1.state[\"DropDownCounty\"].value != nothing","source":"$displayform1.state[\"DropDownCounty\"].value != nothing"}},"position":"20,100","title":"If","transitions":[{"branch":"false","id":513,"inputs":{},"position":"140,130 230,130 230,520 210,520","sourceConnector":"right","target":{"id":501},"targetConnector":"right"},{"branch":"true","id":515,"inputs":{},"position":"20,130 -160,130 -160,220","sourceConnector":"left","target":{"id":503},"targetConnector":"top"}]},{"action":"gcx:wf:core::Exit","id":501,"inputs":{},"position":"30,490","title":"Exit"},{"action":"gcx:wf:arcgis:query:QueryTask","id":503,"inputs":{"outFields":"OBJECTID","returnDistinctValues":false,"returnGeometry":true,"url":{"accessors":["$envWS"],"annotations":[{"count":6,"index":0,"kind":"idref"}],"code":"$envWS.result + \"/rest/services/Administrative/BLM_OR_County_Boundaries/MapServer/13\"","source":"$envWS.result + \"/rest/services/Administrative/BLM_OR_County_Boundaries/MapServer/13\""},"where":{"accessors":["$displayform1"],"annotations":[{"count":13,"index":15,"kind":"idref"}],"code":"\"OBJECTID = \" + $displayform1.state[\"DropDownCounty\"].value","source":"\"OBJECTID = \" +$displayform1.state[\"DropDownCounty\"].value "}},"name":"queryExtentCounty1","position":"-280,220","title":"Query Task","transitions":[{"id":517,"inputs":{},"position":"-160,290 -160,330","sourceConnector":"bottom","target":{"id":505},"targetConnector":"top"}]},{"action":"gcx:wf:arcgis::GetFeatureSetExtent","id":505,"inputs":{"features":{"accessors":["$queryExtentCounty1"],"annotations":[{"count":19,"index":0,"kind":"idref"}],"code":"$queryExtentCounty1.results","source":"$queryExtentCounty1.results"}},"name":"getFeatureSetExtentCounty1","position":"-280,330","title":"Get Feature Set Extent","transitions":[{"id":521,"inputs":{},"position":"-160,400 -160,430","sourceConnector":"bottom","target":{"id":507}}]},{"action":"gcx:wf:arcgis::SetViewExtent","id":507,"inputs":{"geometry":{"accessors":["$getFeatureSetExtentCounty1"],"annotations":[{"count":27,"index":0,"kind":"idref"}],"code":"$getFeatureSetExtentCounty1.extent","source":"$getFeatureSetExtentCounty1.extent"}},"name":"setMapExtentCounty1","position":"-280,430","title":"Set Map Extent","transitions":[{"id":519,"inputs":{},"position":"-160,500 -160,520 30,520","sourceConnector":"bottom","target":{"id":501},"targetConnector":"left"}]},{"action":"gcx:wf:core::Annotation","description":"Takes the User inputs and does REST Queries, to find the Extent of requested feature.","id":509,"inputs":{},"position":"-530,0","title":"Process Notes"}]},{"id":921,"steps":[{"id":923,"inputs":{},"position":"10,0","purpose":"start","title":"Event","transitions":[{"id":933,"inputs":{},"position":"100,60 100,100","sourceConnector":"bottom","target":{"id":925},"targetConnector":"top"}]},{"action":"gcx:wf:arcgis:query:QueryTask","description":"Query for features.","id":925,"inputs":{"orderByFields":"COBCODE, COUNTY_NAME ","outFields":"COBCODE, COUNTY_NAME, OBJECTID","returnDistinctValues":true,"returnGeometry":false,"url":{"accessors":["$envWS"],"annotations":[{"count":6,"index":0,"kind":"idref"}],"code":"$envWS.result + \"/rest/services/Administrative/BLM_OR_County_Boundaries/MapServer/13\"","source":"$envWS.result + \"/rest/services/Administrative/BLM_OR_County_Boundaries/MapServer/13\""},"where":"1=1"},"name":"queryGetCounty1","position":"-20,100","title":"Query Layer","transitions":[{"id":935,"inputs":{},"position":"100,200 100,240","sourceConnector":"bottom","target":{"id":927},"targetConnector":"top"}]},{"action":"gcx:wf:forms::GetFormElementItemsFromFeatures","description":"Convert the features into form element items to be used in the element.","id":927,"inputs":{"features":{"accessors":["$queryGetCounty1"],"annotations":[{"count":16,"index":0,"kind":"idref"}],"code":"$queryGetCounty1.features","source":"$queryGetCounty1.features"},"labelFieldName":"{COBCODE} - {COUNTY_NAME}","valueFieldName":"OBJECTID"},"name":"formElementItems7","position":"-20,240","title":"Get Form Element Items From Features","transitions":[{"id":937,"inputs":{},"position":"100,370 100,440","target":{"id":929}}]},{"action":"gcx:wf:forms::SetFormElementItems","description":"Assign form element items to the element.","id":929,"inputs":{"elementName":"DropDownCounty","form":{"accessors":["$$form"],"annotations":[{"count":6,"index":0,"kind":"idref"}],"code":"$$form","source":"$$form"},"items":{"accessors":["$formElementItems7"],"annotations":[{"count":18,"index":0,"kind":"idref"}],"code":"$formElementItems7.items","source":"$formElementItems7.items"}},"position":"-20,440","title":"Set Form Element Items"},{"action":"gcx:wf:core::Annotation","description":"This process makes use of Placeholder objects in the Label Field of the DropDown, in order to distinguish between duplicate County Names, between the States:  {COBCODE} - {COUNTY_NAME}\n\nAdditionally, the Value Field of the DropDown is set to OBJECTID, so that the Extent Query later, will have a unique Identifier to Zoom To.","id":931,"inputs":{},"position":"-440,220","title":"Notes"}],"title":"populate-DropDownCounty"}],"designerVersion":"5.30.0+19","forms":[{"defaults":{},"elements":{"DropDownCounty":{"enabled":true,"index":1,"items":{},"require":false,"rowIndex":0,"rowNumber":1,"section":{"name":"section1"},"title":{"markdown":"County"},"type":"DropDownList","visible":true},"Footer":{"index":2,"items":{"0":{"index":0,"label":{"markdown":"Cancel"},"value":"cancel"},"1":{"default":true,"index":1,"label":{"markdown":"Submit"},"validates":true,"value":"submit"}},"section":"footer","type":"ButtonBar"},"Header":{"section":"header","title":{"markdown":"Find Location"},"type":"Header"},"section1":{"enabled":true,"index":0,"rowIndex":0,"rowNumber":0,"title":{"markdown":"**Find Location in OR or WA**"},"type":"Section"}},"id":1149}],"licenseInfo":{"licenseeId":"8b20c87f-37bb-7880-bfa3-5a50981503b5"},"start":{"id":3},"transitions":[{"branch":"populate$DropDownCounty","id":1199,"inputs":{},"source":{"id":1159},"target":{"id":923}},{"branch":"content","id":1213,"inputs":{},"source":{"id":1171},"target":{"id":497}}]}

    1
  • Nico Burgerhart

    See also the Search for State sample workflow (File > New) or File > Open By Url https://www.arcgis.com/home/item.html?id=a105e427c5f84e8e9587fc79fc0d9a45

    1
  • lubnan

    Thank you for your reply.

    Ryan, I tried your code, and I replaced our map service instead of your

    url: https://orthophotos.geomolg.ps/adaptor/rest/services/Communities_06/MapServer/1

    The workflow returns a general error as below screenshot:

    my json code:

    {"_properties":{"isServerWorkflow":false},"components":[{"id":2,"steps":[{"id":3,"inputs":{},"position":"710,-70","purpose":"start","title":"Start","transitions":[{"id":1248,"inputs":{},"position":"800,-10 800,70 820,70 820,90","sourceConnector":"bottom","target":{"id":1151},"targetConnector":"top"}]},{"action":"gcx:wf:app::GetApplicationData","id":1151,"inputs":{"key":"keyExternalValue_A"},"name":"getApplicationData1","position":"700,90","title":"Get Application Data","transitions":[{"id":1241,"inputs":{},"position":"820,160 820,180 830,180 830,200","sourceConnector":"bottom","target":{"id":1183},"targetConnector":"top"}]},{"action":"gcx:wf:core::Annotation","description":"$displayform1.state.radioGroup1.value === 'trsRadioValue'\n\n=$displayform1.state[\"DropDownList2\"].value == nothing","id":1153,"inputs":{},"position":"1060,170","title":"Syntax Notes"},{"action":"gcx:wf:core::Annotation","description":"Cannot \"complete\" the Exit loops, from each of the ZoomTo Containers;  When those are hooked up to Exit, the Input Form closes BEFORE users have a chance to choose anything.","id":1155,"inputs":{},"position":"940,710","title":"Exit Notes"},{"action":"gcx:wf:core::Annotation","description":"County Lookups has issues with Duplicate County Names like Benton.\n\nNeed to change the listing to include the State elements as well.  Will probably take some parsing routines.\n","id":1157,"inputs":{},"position":"1220,630","title":"Future Enhancement Notes"},{"action":"gcx:wf:forms:form:DisplayForm","id":1159,"inputs":{"form":{"accessors":[],"code":"resources.forms[values.id]","values":{"id":1149}}},"name":"displayform1","position":"630,340","title":"Display Form","transitions":[{"id":1223,"inputs":{},"position":"750,460 750,510","sourceConnector":"bottom","target":{"id":1161}}]},{"action":"gcx:wf:core::If","id":1161,"inputs":{"condition":{"accessors":["$displayform1"],"annotations":[{"count":13,"index":0,"kind":"idref"}],"code":"$displayform1.result === \"submit\"","source":"$displayform1.result === \"submit\""}},"position":"690,510","title":"If","transitions":[{"branch":"false","id":1225,"inputs":{},"position":"810,540 960,540 960,610 980,610","sourceConnector":"right","target":{"id":1163}},{"branch":"true","id":1227,"inputs":{},"position":"690,540 320,540 320,545 300,545","sourceConnector":"left","target":{"id":1171},"targetConnector":"right"}]},{"action":"gcx:wf:core::Exit","id":1163,"inputs":{},"position":"980,580","title":"Exit"},{"action":"gcx:wf:core::Container","id":1171,"inputs":{},"position":"60,500","title":"County"},{"action":"gcx:wf:core::CreateValue","description":"https://orthophotos.geomolg.ps/adaptor","id":1183,"inputs":{"expression":"https://orthophotos.geomolg.ps/adaptor"},"name":"envWS","position":"710,200","title":"Create Value","transitions":[{"id":1221,"inputs":{},"position":"830,310 830,400 870,400","sourceConnector":"bottom","target":{"id":1159},"targetConnector":"right"}]}]},{"id":495,"steps":[{"id":497,"inputs":{},"position":"0,0","purpose":"start","title":"Container","transitions":[{"id":511,"inputs":{},"position":"90,60 90,80 80,80 80,100","target":{"id":499}}]},{"action":"gcx:wf:core::If","id":499,"inputs":{"condition":{"accessors":["$displayform1","nothing"],"annotations":[{"count":13,"index":0,"kind":"idref"},{"count":7,"index":47,"kind":"idref"}],"code":"$displayform1.state[\"DropDownCounty\"].value != nothing","source":"$displayform1.state[\"DropDownCounty\"].value != nothing"}},"position":"20,100","title":"If","transitions":[{"branch":"false","id":513,"inputs":{},"position":"140,130 230,130 230,520 210,520","sourceConnector":"right","target":{"id":501},"targetConnector":"right"},{"branch":"true","id":515,"inputs":{},"position":"20,130 -160,130 -160,220","sourceConnector":"left","target":{"id":503},"targetConnector":"top"}]},{"action":"gcx:wf:core::Exit","id":501,"inputs":{},"position":"30,490","title":"Exit"},{"action":"gcx:wf:arcgis:query:QueryTask","id":503,"inputs":{"outFields":"CommunityName_Arabic","returnDistinctValues":false,"returnGeometry":true,"url":{"accessors":["$envWS"],"annotations":[{"count":6,"index":0,"kind":"idref"}],"code":"$envWS.result + \"/rest/services/Communities_06/MapServer/1\"","source":"$envWS.result + \"/rest/services/Communities_06/MapServer/1\""},"where":{"accessors":["$displayform1"],"annotations":[{"count":13,"index":26,"kind":"idref"}],"code":"\"CommunityName_Arabic= \" + $displayform1.state[\"DropDownCounty\"].value","source":"\"CommunityName_Arabic= \" +$displayform1.state[\"DropDownCounty\"].value"}},"name":"queryExtentCounty1","position":"-280,220","title":"Query Task","transitions":[{"id":517,"inputs":{},"position":"-160,290 -160,330","sourceConnector":"bottom","target":{"id":505},"targetConnector":"top"}]},{"action":"gcx:wf:arcgis::GetFeatureSetExtent","id":505,"inputs":{"features":{"accessors":["$queryExtentCounty1"],"annotations":[{"count":19,"index":0,"kind":"idref"}],"code":"$queryExtentCounty1.results","source":"$queryExtentCounty1.results"}},"name":"getFeatureSetExtentCounty1","position":"-280,330","title":"Get Feature Set Extent","transitions":[{"id":521,"inputs":{},"position":"-160,400 -160,430","sourceConnector":"bottom","target":{"id":507}}]},{"action":"gcx:wf:arcgis::SetViewExtent","id":507,"inputs":{"geometry":{"accessors":["$getFeatureSetExtentCounty1"],"annotations":[{"count":27,"index":0,"kind":"idref"}],"code":"$getFeatureSetExtentCounty1.extent","source":"$getFeatureSetExtentCounty1.extent"}},"name":"setMapExtentCounty1","position":"-280,430","title":"Set Map Extent","transitions":[{"id":519,"inputs":{},"position":"-160,500 -160,520 30,520","sourceConnector":"bottom","target":{"id":501},"targetConnector":"left"}]},{"action":"gcx:wf:core::Annotation","description":"Takes the User inputs and does REST Queries, to find the Extent of requested feature.","id":509,"inputs":{},"position":"-530,0","title":"Process Notes"}]},{"id":921,"steps":[{"id":923,"inputs":{},"position":"10,0","purpose":"start","title":"Event","transitions":[{"id":933,"inputs":{},"position":"100,60 100,100","sourceConnector":"bottom","target":{"id":925},"targetConnector":"top"}]},{"action":"gcx:wf:arcgis:query:QueryTask","description":"Query for features.","id":925,"inputs":{"outFields":"CommunityName_Arabic","returnDistinctValues":true,"returnGeometry":false,"url":{"accessors":["$envWS"],"annotations":[{"count":6,"index":0,"kind":"idref"}],"code":"$envWS.result + \"/rest/services/Communities_06/MapServer/1\"","source":"$envWS.result + \"/rest/services/Communities_06/MapServer/1\""},"where":"1=1"},"name":"queryGetCounty1","position":"-20,100","title":"Query Layer","transitions":[{"id":935,"inputs":{},"position":"100,200 100,240","sourceConnector":"bottom","target":{"id":927},"targetConnector":"top"}]},{"action":"gcx:wf:forms::GetFormElementItemsFromFeatures","description":"Convert the features into form element items to be used in the element.","id":927,"inputs":{"features":{"accessors":["$queryGetCounty1"],"annotations":[{"count":16,"index":0,"kind":"idref"}],"code":"$queryGetCounty1.features","source":"$queryGetCounty1.features"},"labelFieldName":"{CommunityName_Arabic}","valueFieldName":"CommunityName_Arabic"},"name":"formElementItems7","position":"-20,240","title":"Get Form Element Items From Features","transitions":[{"id":937,"inputs":{},"position":"100,370 100,440","target":{"id":929}}]},{"action":"gcx:wf:forms::SetFormElementItems","description":"Assign form element items to the element.","id":929,"inputs":{"elementName":"DropDownCounty","form":{"accessors":["$$form"],"annotations":[{"count":6,"index":0,"kind":"idref"}],"code":"$$form","source":"$$form"},"items":{"accessors":["$formElementItems7"],"annotations":[{"count":18,"index":0,"kind":"idref"}],"code":"$formElementItems7.items","source":"$formElementItems7.items"}},"position":"-20,440","title":"Set Form Element Items"},{"action":"gcx:wf:core::Annotation","description":"This process makes use of Placeholder objects in the Label Field of the DropDown, in order to distinguish between duplicate County Names, between the States:  {COBCODE} - {COUNTY_NAME}\n\nAdditionally, the Value Field of the DropDown is set to OBJECTID, so that the Extent Query later, will have a unique Identifier to Zoom To.","id":931,"inputs":{},"position":"-440,220","title":"Notes"}],"title":"populate-DropDownCounty"}],"designerVersion":"5.30.0+19","forms":[{"defaults":{},"elements":{"DropDownCounty":{"enabled":true,"index":1,"items":{},"require":false,"rowIndex":0,"rowNumber":1,"section":{"name":"section1"},"title":{"markdown":"County"},"type":"DropDownList","visible":true},"Footer":{"index":2,"items":{"0":{"index":0,"label":{"markdown":"Cancel"},"value":"cancel"},"1":{"default":true,"index":1,"label":{"markdown":"Submit"},"validates":true,"value":"submit"}},"section":"footer","type":"ButtonBar"},"Header":{"section":"header","title":{"markdown":"Find Location"},"type":"Header"},"section1":{"enabled":true,"index":0,"rowIndex":0,"rowNumber":0,"title":{"markdown":"**Find Location in OR or WA**"},"type":"Section"}},"id":1149}],"licenseInfo":{"licenseUrl":"https://portal2.geomolg.ps/vertigisstudio/workflow/service/auth/license"},"start":{"id":3},"transitions":[{"branch":"populate$DropDownCounty","id":1199,"inputs":{},"source":{"id":1159},"target":{"id":923}},{"branch":"content","id":1213,"inputs":{},"source":{"id":1171},"target":{"id":497}}]}

    What might be the issue here:

    Best,

    Lubna

     

     

     

     

     

    0
  • Ryan Kelley

    Hi Lubna - Mine was just a sample. You'll need to adjust all parts of your workflow, including field names and not just the service urls. Nico's suggestion might be easier to follow, and I'd start there.

    1
  • lubnan

    Thank you for your help

    The workflow works fine with me using our data

     

    Best,

    Lubna

    0

Please sign in to leave a comment.