Relationship Query Task Activity
I have some questions regarding the new Relationship Query Task Activity in Workflow Designer.
There is an Object Ids field, of type String. I understand what this is from the documentation, but I don't know what to send it. Just before this task in my workflow, I have a Query Task that gets the feature (or features) that the user clicked. I translate these into a DataTable, assign its TableName, and Add it to a common DataSet object. If the click result is in fsClickedFeatures and then becomes a DataTable called dtClickedFeatures, what would I pass into the Object Ids parameter.
Second, what do I do with the result of type ESRI.ArcGIS.Client.Tasks.RelationshipResult? I need it converted into a DataTable so I can throw it into a report for the Template Report activity.
"Roj"
-
Via another thread, I got my second question answered. But the first question remains unanswered. Although I can hard-code an FID into the Object IDs parameter, how would I get the actual FID of the feature clicked on, with the resulting FeatureSet? Would I access a Rows property, then a Fields property, then a dictionary or something?
"Roj"
0 -
Hi Roger,
If you have a feature set (called featureSet1 for example), you can get the object id of the first feature by using the following syntax:
featureSet1.features(0).attributes("OBJECTID").toString
You can use this directly in the Object Ids parameter of the Relationship Query Task activity, or if you want to use multiple Object IDs you can loop through all of the features in the feature set and append them to a string variable with commas between each object id. You would then need to change the '0' in the above line to use the incrementing index.
0 -
Hi Roger & Victoria,
Could either of you elaborate on how you implemented the "loop through all of the features in the feature set and append them to a string variable with commas between each object id"?
Thanks,
Warren
0 -
Warren,
- Declare a variable of type String that will hold the delimited string, and set its Default Value to "" OR set it to the base value of what you need. In my case, it was the base URL of the page that needed to be opened.
- Declare another variable called bAddComma of type Boolean and set its Default value to False.
- From the Control Flow category, drop the For Each <T> tool onto your workflow. You will have to pick a type for T, so choose ESRI.ArcGIS.Client.Graphic .
- Supply your FeatureSet as the Values property.
- In the diagram, supply a name for the Foreach argument. This doesn't appear to show up as a variable, though, neither does it appear in the Properties window on the right. Hm.
- Inside the Body of your For Each tool, drop a Sequence .
- Inside the Sequence , drop an If tool. The Condition for the If tool is the Boolean you declared (bAddComma).
- In both the Then and the Else boxes, drop an Assign tool.
- In the Then Assign tool, assign your String to be itself plus ", ".
- In the Else Assign tool, assign your Boolean (bAddComma) to be True for next time around.
- Drag another Assign tool onto the workflow, after the If tool. Assign your String to be itself plus your Foreach argument.Attributes("<fieldname>").ToString.
- For debugging purposes, you can drop a Write Line after the last Assign and set its Text property to the String you're concatenating. When you're debugging, you should see this string get set to a longer and longer, comma-delimited, string.
- Outside of the For Each tool, you can do what you need to with the String, like put it in a URL, use it for another Query, show it to the user, etc.
I hope this helps!
"Roj"
0 -
Hi Roger,
That worked perfectly! Thanks so much for replying.
Warren
0
Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.
Kommentare
5 Kommentare