Using edit.display-update-feature to edit an existing feature.
I am trying to create a workflow where a user can select a feature from the map and then edit the geometry / attributes from this feature. I think this can be done using the Run Command tool with the edit.display-update-feature Command. I read somewhere that I need to convert the feature from the Query Layer tool using the Run Operation tool with the Operation results.from-graphics.
Can someone provide a working sample with a Query Layer requesting one feature from https://sampleserver6.arcgisonline.com/arcgis/rest/services/Wildfire/FeatureServer/0 and then make edit.display-update-feature work with this feature? Or point me to a sample / tutorial / anything I can use as a start?
I tried a lot of things but nothing seems to work. I'm using VertiGIS Studio Web Version 5.30.0 and VertiGIS Studio Workflow Version 5.39.1 if that matters.
Thanks, Niels
-
Hi Niels,
I've attached a simplified version of a workflow which I think does what you are asking (or will hopefully give you some pointers if it doesn't do exactly what you want).
The workflow presents a list of layers that we want to edit. Once we've selected the layer, we then need to click on the particular feature we want to edit. It should be simple enough to either select the individual feature without selecting the layer first though, or to present a list instead of clicking on the feature.
Once you have feature you want to edit, you need to use a results.from-graphics operation and then a results.display-details command. I found that I needed to add a slight delay after that, before using an edit.display-update-feature command.
From there, the edit menu will be opened. Just to point out that this was built for VS Mobile - it should still work in Web, but there may well be more efficent ways to do it in Web.
Regards,
Aled
{"_properties":{"isServerWorkflow":false},"components":[{"id":2,"steps":[{"id":3,"inputs":{},"position":"0,-100","purpose":"start","title":"Start","transitions":[{"id":220,"inputs":{},"position":"90,-40 90,0","sourceConnector":"bottom","target":{"id":219}}]},{"action":"gcx:wf:core::Container","id":42,"inputs":{},"position":"-30,110","title":"StartUp Container","transitions":[{"id":48,"inputs":{},"position":"90,200 90,250","sourceConnector":"bottom","target":{"id":46}}]},{"action":"gcx:wf:forms:form:DisplayForm","id":46,"inputs":{"form":{"accessors":[],"code":"resources.forms[values.id]","values":{"id":47}}},"name":"form1","position":"-30,250","title":"Display Form","transitions":[{"id":189,"inputs":{},"position":"90,370 90,400 210,400 210,420","sourceConnector":"bottom","target":{"id":184}}]},{"action":"gcx:wf:core::If","id":184,"inputs":{"condition":{"accessors":["$form1"],"annotations":[{"count":6,"index":0,"kind":"idref"}],"code":"$form1.result == \"select\"","source":"$form1.result == \"select\""}},"position":"150,420","title":"If","transitions":[{"branch":"false","id":196,"inputs":{},"position":"270,450 350,450 350,500","sourceConnector":"right","target":{"id":192},"targetConnector":"top"},{"branch":"true","id":450,"inputs":{},"position":"150,450 -50,450 -50,590","sourceConnector":"left","target":{"id":446},"targetConnector":"top"}]},{"action":"gcx:wf:core::Exit","id":192,"inputs":{},"position":"260,500","title":"Exit"},{"action":"gcx:wf:arcgis::GetMap","id":219,"inputs":{},"name":"map","position":"-30,0","title":"Get Map","transitions":[{"id":222,"inputs":{},"position":"90,60 90,110","target":{"id":42}}]},{"action":"gcx:wf:core::Container","id":446,"inputs":{},"position":"-170,590","title":"Edit Container"}]},{"id":6,"steps":[{"id":8,"inputs":{},"position":"0,0","purpose":"start","title":"Container","transitions":[{"id":26,"inputs":{},"position":"90,60 90,110","sourceConnector":"bottom","target":{"id":10}}]},{"action":"gcx:wf:app::GetApplicationData","id":10,"inputs":{"key":"workOrder"},"name":"workOrderApplicationData","position":"-30,110","title":"Get Application Data","transitions":[{"id":28,"inputs":{},"position":"90,180 90,220","sourceConnector":"bottom","target":{"id":12}}]},{"action":"gcx:wf:app::GetApplicationData","id":12,"inputs":{"key":"activityRef"},"name":"activityRefApplicationData","position":"-30,220","title":"Get Application Data","transitions":[{"id":36,"inputs":{},"position":"90,290 90,330","target":{"id":14}}]},{"action":"gcx:wf:arcgis::GetLayer","id":14,"inputs":{"layerId":"Redline Job Class"},"name":"jobLayer","position":"-30,330","title":"Get Layer","transitions":[{"id":30,"inputs":{},"position":"90,400 90,450","sourceConnector":"bottom","target":{"id":16}}]},{"action":"gcx:wf:arcgis::GetLayer","id":16,"inputs":{"layerId":"Redline SewerLine"},"name":"linkLayer","position":"-30,450","title":"Get Layer","transitions":[{"id":32,"inputs":{},"position":"90,520 90,570","sourceConnector":"bottom","target":{"id":18}}]},{"action":"gcx:wf:arcgis::GetLayer","id":18,"inputs":{"layerId":"Redline SewerDevice"},"name":"nodeLayer","position":"-30,570","title":"Get Layer","transitions":[{"id":34,"inputs":{},"position":"90,640 90,690","sourceConnector":"bottom","target":{"id":20}}]},{"action":"gcx:wf:arcgis::GetLayer","id":20,"inputs":{"layerId":"Redline Picture"},"name":"attachmentLayer","position":"-30,690","title":"Get Layer","transitions":[{"id":538,"inputs":{},"position":"90,760 90,830","sourceConnector":"bottom","target":{"id":537},"targetConnector":"top"}]},{"action":"gcx:wf:arcgis::GetViewExtent","id":22,"inputs":{},"name":"mapExtentInitial","position":"-30,1560","title":"Get Map Extent","transitions":[{"id":38,"inputs":{},"position":"90,1630 90,1680","sourceConnector":"bottom","target":{"id":24}}]},{"action":"gcx:wf:arcgis::GetLayer","id":24,"inputs":{"layerId":"S4 Work Order"},"name":"WOLayer","position":"-30,1680","title":"Get Layer","transitions":[{"id":102,"inputs":{},"position":"90,1750 90,1800","sourceConnector":"bottom","target":{"id":101}}]},{"action":"gcx:wf:core::CreateValue","id":101,"inputs":{"expression":{"accessors":[],"annotations":[],"code":"[]","source":"[]"}},"name":"layerNameCollection","position":"-30,1800","title":"Create Value"},{"action":"gcx:wf:arcgis::GetLayer","id":183,"inputs":{"layerId":"Markup Notes"},"name":"notesLayer","position":"-30,950","title":"Get Layer","transitions":[{"id":191,"inputs":{},"position":"90,1020 90,1080","target":{"id":188}}]},{"action":"gcx:wf:arcgis::GetLayer","id":186,"inputs":{"layerId":"Markup Polygon"},"name":"polyLayer","position":"-30,1200","title":"Get Layer","transitions":[{"id":311,"inputs":{},"position":"90,1270 90,1320","sourceConnector":"bottom","target":{"id":310}}]},{"action":"gcx:wf:arcgis::GetLayer","id":188,"inputs":{"layerId":"Redline Line"},"name":"lineLayer","position":"-30,1080","title":"Get Layer","transitions":[{"id":194,"inputs":{},"position":"90,1150 90,1200","target":{"id":186}}]},{"action":"gcx:wf:arcgis::GetLayer","id":310,"inputs":{"layerId":"Markup Line"},"name":"lineNotesLayer","position":"-30,1320","title":"Get Layer","transitions":[{"id":253,"inputs":{},"position":"90,1390 90,1440","target":{"id":340}}]},{"action":"gcx:wf:arcgis::GetLayer","id":340,"inputs":{"layerId":"Markup Point"},"name":"pointMarkupLayer","position":"-30,1440","title":"Get Layer","transitions":[{"id":254,"inputs":{},"position":"90,1510 90,1560","target":{"id":22}}]},{"action":"gcx:wf:arcgis::GetLayer","id":537,"inputs":{"layerId":"Redline Point"},"name":"pointLayer","position":"-30,830","title":"Get Layer","transitions":[{"id":539,"inputs":{},"position":"90,900 90,950","target":{"id":183},"targetConnector":"top"}]}]},{"id":58,"steps":[{"id":59,"inputs":{},"position":"0,0","purpose":"start","title":"Event","transitions":[{"id":64,"inputs":{},"position":"90,60 90,110","sourceConnector":"bottom","target":{"id":63}}]},{"action":"gcx:wf:arcgis:query:QueryTask","description":"Query for features.","id":63,"inputs":{"layer":{"accessors":["$linkLayer"],"annotations":[{"count":10,"index":0,"kind":"idref"}],"code":"$linkLayer.layer","source":"$linkLayer.layer"},"outFields":"*","returnGeometry":true,"where":{"accessors":["$activityRefApplicationData"],"annotations":[{"count":27,"index":23,"kind":"idref"}],"code":"\"redline_jobnumber='\" + $activityRefApplicationData.value + \"'\"","source":"\"redline_jobnumber='\"+ $activityRefApplicationData.value+\"'\""}},"name":"query12","position":"-30,110","title":"Query Layer","transitions":[{"id":79,"inputs":{},"position":"90,200 90,250 210,250 210,270","sourceConnector":"bottom","target":{"id":78}}]},{"action":"gcx:wf:core::If","id":78,"inputs":{"condition":{"accessors":["$query12"],"annotations":[{"count":8,"index":0,"kind":"idref"}],"code":"$query12.features.length > 0","source":"$query12.features.length > 0"}},"position":"150,270","title":"If","transitions":[{"branch":"true","id":80,"inputs":{},"position":"150,300 -50,300 -50,290 -190,290 -190,310","target":{"id":103},"targetConnector":"top"},{"branch":"false","id":545,"position":"270,300 290,300 290,460 60,460 60,480","sourceConnector":"right","target":{"id":117},"targetConnector":"top"}]},{"action":"gcx:wf:core::AddItem","id":103,"inputs":{"collection":{"accessors":["$layerNameCollection"],"annotations":[{"count":20,"index":0,"kind":"idref"}],"code":"$layerNameCollection.result","source":"$layerNameCollection.result"},"item":{"accessors":[],"annotations":[],"code":"{\n \"LayerName\": \"Sewer Line\"\n}","source":"{\n \"LayerName\": \"Sewer Line\"\n}"}},"position":"-310,310","title":"Add Item","transitions":[{"id":544,"position":"-190,340 -190,460 60,460 60,480","sourceConnector":"bottom","target":{"id":117},"targetConnector":"top"}]},{"action":"gcx:wf:forms::GetFormElementItemsFromCollection","id":117,"inputs":{"collection":{"accessors":["$layerNameCollection"],"annotations":[{"count":20,"index":0,"kind":"idref"}],"code":"$layerNameCollection.result","source":"$layerNameCollection.result"},"labelFieldName":"LayerName","valueFieldName":"LayerName"},"name":"formElementItems2","position":"-60,480","title":"Get Form Element Items From Collection","transitions":[{"id":121,"inputs":{},"position":"60,540 60,650","sourceConnector":"bottom","target":{"id":120},"targetConnector":"top"}]},{"action":"gcx:wf:forms::SetFormElementItems","id":120,"inputs":{"elementName":"dropDownList1","form":{"accessors":["$$form"],"annotations":[{"count":6,"index":0,"kind":"idref"}],"code":"$$form","source":"$$form"},"items":{"accessors":["$formElementItems2"],"annotations":[{"count":18,"index":0,"kind":"idref"}],"code":"$formElementItems2.items","source":"$formElementItems2.items"}},"position":"-60,650","title":"Set Form Element Items"}],"title":"load-dropDownList1"},{"id":321,"steps":[{"id":322,"inputs":{},"position":"0,0","purpose":"start","title":"Event","transitions":[{"id":335,"inputs":{},"position":"90,60 90,130","sourceConnector":"bottom","target":{"id":328},"targetConnector":"top"}]},{"action":"gcx:wf:forms::ShowFormElement","id":326,"inputs":{"elementName":"text1","form":{"accessors":["$$form"],"annotations":[{"count":6,"index":0,"kind":"idref"}],"code":"$$form","source":"$$form"},"visible":true},"position":"-240,230","title":"Show Form Element"},{"action":"gcx:wf:core::If","id":328,"inputs":{"condition":{"accessors":["$form1"],"annotations":[{"count":6,"index":0,"kind":"idref"}],"code":"$form1.state.dropDownList1.value == \"Markup/Notes\"","source":"$form1.state.dropDownList1.value == \"Markup/Notes\""}},"position":"30,130","title":"If","transitions":[{"branch":"true","id":332,"inputs":{},"position":"30,160 -120,160 -120,230","sourceConnector":"left","target":{"id":326},"targetConnector":"top"},{"branch":"false","id":334,"inputs":{},"position":"150,160 230,160 230,230","sourceConnector":"right","target":{"id":330},"targetConnector":"top"}]},{"action":"gcx:wf:forms::ShowFormElement","id":330,"inputs":{"elementName":"text1","form":{"accessors":["$$form"],"annotations":[{"count":6,"index":0,"kind":"idref"}],"code":"$$form","source":"$$form"},"visible":false},"position":"110,230","title":"Show Form Element"}],"title":"change-dropDownList1"},{"id":447,"steps":[{"action":"gcx:wf:core::If","id":431,"inputs":{"condition":{"accessors":["$query30"],"annotations":[{"count":8,"index":0,"kind":"idref"}],"code":"$query30.features.length > 0","source":"$query30.features.length > 0"}},"position":"150,650","title":"If","transitions":[{"branch":"false","id":435,"inputs":{},"position":"270,680 220,680 220,730","sourceConnector":"right","target":{"id":433},"targetConnector":"top"},{"branch":"true","id":437,"inputs":{},"position":"150,680 80,680 80,790 90,790 90,810","sourceConnector":"left","target":{"id":466},"targetConnector":"top"}]},{"action":"gcx:wf:ui::Alert","id":433,"inputs":{"text":"No feature found. Please try again.","title":"Warning"},"position":"100,730","title":"Alert"},{"action":"gcx:wf:core::Exit","id":440,"inputs":{},"position":"60,1260","title":"Exit"},{"id":448,"inputs":{},"position":"0,-280","purpose":"start","title":"Container","transitions":[{"id":405,"inputs":{},"position":"90,-220 90,-100","sourceConnector":"bottom","target":{"id":456},"targetConnector":"top"}]},{"action":"gcx:wf:forms:form:DisplayForm","id":456,"inputs":{"form":{"accessors":[],"code":"resources.forms[values.id]","values":{"id":454}}},"name":"form2","position":"-30,-100","title":"Display Form","transitions":[{"id":484,"inputs":{},"position":"90,20 90,70","sourceConnector":"bottom","target":{"id":481}}]},{"action":"gcx:wf:core::Switch","id":460,"inputs":{"value":{"accessors":["$form1"],"annotations":[{"count":6,"index":0,"kind":"idref"}],"code":"$form1.state.dropDownList1.value","source":"$form1.state.dropDownList1.value"}},"position":"-30,340","title":"Switch","transitions":[{"id":477,"inputs":{},"position":"90,400 90,500","purpose":"default","sourceConnector":"bottom","target":{"id":464},"targetConnector":"top","title":"Sewer Line"}]},{"action":"gcx:wf:arcgis:query:QueryTask","description":"Query for features.","id":464,"inputs":{"geometry":{"accessors":["$buffer1"],"annotations":[{"count":8,"index":0,"kind":"idref"}],"code":"$buffer1.geometry","source":"$buffer1.geometry"},"layer":{"accessors":["$linkLayer"],"annotations":[{"count":10,"index":0,"kind":"idref"}],"code":"$linkLayer.layer","source":"$linkLayer.layer"},"outFields":"*","returnGeometry":true,"where":{"accessors":["$activityRefApplicationData"],"annotations":[{"count":27,"index":23,"kind":"idref"}],"code":"\"redline_jobnumber='\" + $activityRefApplicationData.value + \"'\"","source":"\"redline_jobnumber='\"+ $activityRefApplicationData.value+\"'\""}},"name":"query30","position":"-30,500","title":"Query Layer","transitions":[{"id":436,"inputs":{},"position":"90,590 90,630 210,630 210,650","sourceConnector":"bottom","target":{"id":431},"targetConnector":"top"}]},{"action":"gcx:wf:core::Delay","id":465,"inputs":{"duration":1000},"position":"-30,1070","title":"Delay","transitions":[{"id":471,"inputs":{},"position":"90,1100 90,1140","target":{"id":470}}]},{"action":"gcx:wf:app::RunOperation","description":"results.from-graphics","id":466,"inputs":{"operationName":"results.from-graphics","operationParameter":{"accessors":["$query30","$map","$linkLayer"],"annotations":[{"count":8,"index":13,"kind":"idref"},{"count":4,"index":39,"kind":"idref"},{"count":10,"index":66,"kind":"idref"}],"code":"{\n graphics: [$query30.feature],\n maps: [$map.map.extension],\n layer: $linkLayer.layer.id,\n fetchAttachments: true,\n fetchRelatedFeatures: true\n}","source":"{\ngraphics: [$query30.feature],\nmaps: [$map.map.extension],\nlayer:$linkLayer.layer.id,\nfetchAttachments: true,\nfetchRelatedFeatures: true\n}"}},"name":"runOperation4","position":"-30,810","title":"Run Operation","transitions":[{"id":566,"inputs":{},"position":"90,900 90,960","sourceConnector":"bottom","target":{"id":468}}]},{"action":"gcx:wf:app::RunCommand","description":"results.display-details","id":468,"inputs":{"commandName":"results.display-details","commandParameter":{"accessors":["$runOperation4"],"annotations":[{"count":14,"index":0,"kind":"idref"}],"code":"$runOperation4.result[0]","source":"$runOperation4.result[0]"}},"position":"-30,960","title":"Run Command","transitions":[{"id":567,"inputs":{},"position":"90,1020 90,1070","sourceConnector":"bottom","target":{"id":465},"targetConnector":"top"}]},{"action":"gcx:wf:app::RunCommand","description":"edit.display-update-feature","id":470,"inputs":{"commandName":"edit.display-update-feature","commandParameter":{"accessors":["$runOperation4"],"annotations":[{"count":14,"index":0,"kind":"idref"}],"code":"$runOperation4.result[0]","source":"$runOperation4.result[0]"}},"position":"-30,1140","title":"Run Command","transitions":[{"id":441,"inputs":{},"position":"90,1200 90,1240 150,1240 150,1260","sourceConnector":"bottom","target":{"id":440}}]},{"action":"gcx:wf:arcgis::BufferEngineTask","id":478,"inputs":{"distance":{"accessors":["$value1"],"annotations":[{"count":7,"index":0,"kind":"idref"}],"code":"$value1.result","source":"$value1.result"},"geometry":{"accessors":["$form2"],"annotations":[{"count":6,"index":0,"kind":"idref"}],"code":"$form2.state.geometryPicker1.value.geometry[0]","source":"$form2.state.geometryPicker1.value.geometry[0]"},"unit":"meters"},"name":"buffer1","position":"-30,190","title":"Buffer Geometry","transitions":[{"id":486,"inputs":{},"position":"90,250 90,340","sourceConnector":"bottom","target":{"id":460},"targetConnector":"top"}]},{"action":"gcx:wf:core::CreateValue","id":481,"inputs":{"expression":1},"name":"value1","position":"-30,70","title":"Create Value","transitions":[{"id":485,"inputs":{},"position":"90,140 90,190","sourceConnector":"bottom","target":{"id":478}}]}]}],"deploymentConfig":{"supportedApps":{"VSM":true}},"designerVersion":"5.39.1+3","forms":[{"defaults":{},"elements":{"dropDownList1":{"enabled":true,"index":0,"items":{"0":{"index":0,"label":{"markdown":"Option1"}},"1":{"index":1,"label":{"markdown":"Option2"}},"2":{"index":2,"label":{"markdown":"Option3"}}},"rowIndex":0,"rowNumber":0,"title":{"markdown":"Select layer to edit"},"type":"DropDownList"},"footer":{"enabled":true,"items":{"0":{"default":true,"index":0,"label":{"markdown":"Select"},"validates":true,"value":"select"},"1":{"index":1,"label":{"markdown":"Cancel"},"validates":true,"value":"cancel"}},"section":"footer","type":"ButtonBar"},"header":{"section":"header","title":{"markdown":"Layers to Edit"},"type":"Header"}},"id":47},{"defaults":{},"elements":{"footer":{"enabled":true,"items":{"0":{"default":true,"index":0,"label":{"markdown":"Submit"},"validates":true,"value":"submit"}},"section":"footer","type":"ButtonBar"},"geometryPicker1":{"autoActivate":true,"enabled":true,"format":"point","index":0,"itemLabel":{"markdown":"Location"},"prompt":{"markdown":"Add Location"},"require":true,"rowIndex":0,"rowNumber":0,"size":1,"title":{"markdown":"Click on the feature to update"},"type":"GeometryPicker"},"header":{"section":"header","title":{"markdown":"Select Feature to Edit"},"type":"Header"}},"id":454}],"licenseInfo":{"licenseeId":"761610a8-7e76-1b0f-49ed-148ac3dfc752"},"start":{"id":3},"transitions":[{"branch":"content","id":44,"inputs":{},"source":{"id":42},"target":{"id":8}},{"branch":"load$dropDownList1","id":60,"inputs":{},"source":{"id":46},"target":{"id":59}},{"branch":"changed$dropDownList1","id":323,"inputs":{},"source":{"id":46},"target":{"id":322}},{"branch":"content","id":449,"inputs":{},"source":{"id":446},"target":{"id":448}}]}
1 -
Thanks Aled Nicholas I will try and implement this.
From there, the edit menu will be opened. Just to point out that this was built for VS Mobile - it should still work in Web, but there may well be more efficent ways to do it in Web.
If there is a better way, can you elaborate how this should be done in Web? Any samples / tutorials available? We are migrating from Geocortex Essentials HTML5 & Workflow 4 and I need to recreate a large number of workflows. It would be great to do it the right way directly from the start.
0 -
I tried to implement this but I had no succes. I should have mentioned that my source is a MapImageLayer and I write the result to a FeatureLayer. This is because the styling options of a FeatureLayer are not sufficient for what we need in the viewer.
0 -
Hi Niels,
I can't really elaborate how this would be done differently in Web as such - it was just that I had built this for use in Mobile, so hadn't given any thought to whether there were any additional commands available in Web/were only available in Mobile. Having a a quick skim through the commands and operations (https://developers.vertigisstudio.com/docs/web/api-commands-operations/#commands), it doesn't look like there would be anything you would need to do differently in Web.
I'm not sure what impact the MapImageLayer would have - it may be worth testing the query intially and just seeing if you can get the following operations and commands working on that. Presumably then, you would be opening the edit menu for the FeatureLayer.
0 -
Clear, thanks for your time, when I have it working I will post it here.
0
Please sign in to leave a comment.
Comments
5 comments