Update attributes (feature service)

View inAndroidFormsUWPWPFWinUIiOSView on GitHub

Update feature attributes in an online feature service.

Image of update attributes feature service

Use case

Online feature services can be updated with new data. This is useful for updating existing data in real time while working in the field.

How to use the sample

To change the feature's damage property, tap the feature to select it, and update the damage type using the drop down.

How it works

  1. Create a ServiceFeatureTable object from a URL.
    • When the table loads, you can get the domain to determine which options to present in your UI.
  2. Create a FeatureLayer object from the ServiceFeatureTable.
  3. Select features from the FeatureLayer.
  4. To update the feature's attribute, first load it, then use the SetAttributeValue.
  5. Update the table with UpdateFeatureAsync.
  6. After a change, apply the changes on the server using ApplyEditsAsync.

Relevant API

  • ArcGISFeature
  • FeatureLayer
  • ServiceFeatureTable

Tags

amend, attribute, details, edit, editing, information, value

Sample Code

UpdateAttributes.xamlUpdateAttributes.xamlUpdateAttributes.xaml.cs
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<UserControl
    x:Class="ArcGISRuntime.UWP.Samples.UpdateAttributes.UpdateAttributes"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:esriUI="using:Esri.ArcGISRuntime.UI.Controls">
    <Grid>
        <esriUI:MapView x:Name="MyMapView" />
        <Border Style="{StaticResource BorderStyle}">
            <StackPanel Orientation="Vertical">
                <TextBlock Text="Tap to select a feature, then change its damage type."
                       TextWrapping="Wrap"
                       FontWeight="SemiBold" />
                <ComboBox x:Name="DamageTypeDropDown"
                          HorizontalAlignment="Stretch"
                          Margin="0,5,0,0"
                          IsEnabled="False"/>
            </StackPanel>
        </Border>
    </Grid>
</UserControl>

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.