Edit Attributes of Newly Added Features
I'm using a workflow to copy the geometry of a feature from one feature service and add it as a new feature to another feature service.
What I'm trying to do now is automatically populate some of the fields for the newly added features. I've tried taking the Result of the AddFeatures activity, but it's an IList, and I can't do FeatureSet activities with it.
My objective is to simply copy one or two attributes from the Input feature service and paste them to the corresponding features of the Target feature service... for example:
Copy the PropertyID of the Properties feature service and paste it into the NewPropertyID field of the SubProperties service.
Anyone have any ideas?
0
-
Hi Craig,
You actually want to assign the attributes to the new feature before the "Add Features" activity so that once the feature has been added to the layer, it already contains the geometry and the attributes.
I'm not sure how your workflow is set up but I assume you have a Query Task to find the geometry of the feature you want to copy. So the activity returns a featureSet containing that feature.
Next you will use that feature to create your new feature in a series of Assign activities like this:newFeature = new Graphic newFeature.Geometry = featureSet.Features.First().Geometry //Assign geometry to new feature newFeature.Attributes("NewPropertyID") = featureSet.Features.First().Attributes("PropertyID") //Assign attributes
You can assign the new feature as many attributes as you want following the last line in the code above. Once everything has been assigned, you can add the new feature to a new feature set, and then reference that feature set in the "Add Features" activity. This code gallery sample:
https://support.geocortex.com/essentialsGSCCodeGallery?sub-nav=codegall&main-nav=essentials&#!/feedtype=SINGLE_ARTICLE_SEARCH_RESULT&id=kA4600000004EWU
is not exactly what you are looking for but it will definitely help you get started. The "AddPoint.xaml" in particular is very close to what you want to achieve.
I hope this helps
Carmen0 -
Carmen,
Thanks so much for responding. I was able to work out a solution using the resources you provided.
I wish I had asked sooner!
For anyone who looks at this in the future, I used an iterator in a ForEach<Graphic> activity to copy multiple features. In this case, I needed to use:newFeature.Attributes("Parcel_ID") = featureSet.Features.Item(whileInt).Attributes("PIN") Rather than newFeature.Attributes("Parcel_ID") = featureSet.Features.First().Attributes("PIN")whileInt is an Int32-type variable with Default set to 0. As the workflow processes each feature in the feature set, it also increments the whileInt variable by '1' to match the index of the according features in the feature set.0 -
This was very helpful thank you. Not a related question, but perhaps you can help me. I would like to findout how to change a field name in my FeatureSet?
Any assistance is appreciated!0
Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.
Kommentare
3 Kommentare