Not able to retrieve feature attributes
I'm referring on this post, where I added a comment but didn't receive an answer.
I'm using VertiGIS Studio Mobile. In the app, I want to intersect the selected area/polygon with polylines. I set an workflow as feature action of the area. In the workflow itself I have to query the selected polygon object from the layer. In order to query just the selected feature, I need the OBJECT-ID.
I followed instructions like https://docs.vertigisstudio.com/workflow/latest/help/Default.htm#wf5/help/workflow-inputs.htm and many more.
For debugging reasons I logged the workflow input with $getWorkflowInputs1.inputs.context
as well as $getWorkflowInputs1.inputs.context[0]
. This does not work. I receive following error:

I also tried to convert the object to json and back to an object as proposed in this issue and this post. Still does not work:

I hope you can help me.
Thanks in advance,
Yannik
-
Hi Yannik,
You'll need to convert your workflow inputs to a graphic in order for them to work in Mobile. If you add a ‘Run Operation’ activity to your workflow with a Operation Name of ‘results.to-graphics’ and the operation parameter of ‘$getWorkflowInputs1.inputs.context’ you should then see an object where you can query the object ID from $getWorkflowInputs1.inputs.context[0].attributes["OBJECTID"].
1 -
Going step by step:
- Use the get layer activity, this will get all of the layer information (token, schema, url, etc.) that a bunch of follow on activities in the workflow are going to need. There's a Get Table activity for GDB objects that are a table (no spatial data). In the Layer Id box, enter in the name of the layer from your AGOL/Portal web map with no quotes
- Connect the Get Workflow Inputs activity, there are no arguments for this activity
- Connect the Run Operation activity, set the input arguments to the following, the operation parameter will be the context object from the get workflow inputs (=$getWFInputs.inputs.context)
- Attach the Query Layer activity and specify the following inputs, you can also use this activity to do some more advanced querying based on geometry and other spatial operations:
- Layer - =$CulvertLyr.layer
- Where - =$getWFInputs.inputs.context.attributes["OBJECTID"]
- Return Geometry - True (this will return the geometry from the feature layer)
- Output
- Fields - * (this will return all fields in the service; If you want to limit the return, you can use the field names separated by a comma)
When you save and run this workflow, the result back from the query layer should be a feature that you can then work with, I would usually use a display form to load the query results to let users update the data.
1 -
Thank you very much Bryan! Now the Object-ID is passed through!
Unfortunately the Query Layer activity gives me all polygons. Logging
$query2.features.length
is 4 in my case. Maybe the Where-Clause is incorrect:=$getWorkflowInputs1.inputs.context[0].attributes["OBJECTID"]
? If I log this, I receive the correct number.Do you know what's wrong here?
0 -
I think I messed up the Where clause; if you're still looking for the object id, try this in the where clause of the query activity: =$'ObjectID = '+$getWorkflowInputs1.inputs.context[0].attributes["OBJECTID"].
0 -
No unfortunately no progress:
0 -
lose the $ after the equal sign and before the '
1 -
That did the trick! Thanks a lot!
0 -
Hi Bryan Bingham ,
I have another issue similar to the one above. Still using VertiGIS Studio Mobile.
I try to add default values to some attributes of new features drawn and added by the user in the app. So I followed the steps documented here: https://developers.vertigisstudio.com/blog/2023/03/01/mobile-generic-event-listener/ . Instead of layer.visibility-changed I use edit.feature-added. Is this the easiest way to do it?
Unfortunately I am not able to get the feature as an input like it is described in this section. In the workflow which is (successfully) invoked by the event, I added “Get Workflow Input” and for developing reasons a Log-Activity. Therein I tried:
$getWorkflowInputs1.inputs.context $getWorkflowInputs1.inputs.context[0] $getWorkflowInputs1.inputs.context.Feature
… and many more. I can see in the protocol, that the context is undefined. As an argument I receive “vertigis.arcgisextensions.data.feature”.
I also tried to convert the input in a graphic like you proposed in the issue above - no success.
I hope you can help me.
Thanks in advance!
Yannik0 -
I believe for Mobile you cannot use an array indexer like [0]. Try to use one of the following activities.
1 -
Like this?
Log Result:
Is it possible that the feature is not transferred correctly to the workflow?
0 -
It's possible, but unlikely. What does the debugger tell you about the getInputs result?
For reference: https://docs.vertigisstudio.com/workflow/latest/help/Default.htm#wf5/help/logging.htm#turn-on-verbose-logging-in-gxm
0 -
This is the result of the Get Workflow Inputs-Activity:
System.Collections.Generic.Dictionary`2[System.String,System.Object]
0
Du måste logga in om du vill lämna en kommentar.
Kommentarer
12 kommentarer