Use branch versioned data

Use branch versioned data when you want to provide multiuser editing in a service-oriented architecture through feature services and your users don't need direct access to the geodatabase. To compare versioning types, see Versioning types in the ArcGIS Pro documentation.

To use branch versioning in your app:

Branched versioned data can be edited offline the same way you edit feature services offline or use individual layers offline, as described in the Edit data from a branch version section.

Why use branch versioning

With branch versioning, editors can work within their own personal version of a geodatabase so that other users don't see incomplete work and editors don't block one another from accessing the data. Each version can represent ongoing work, such as a design or a group of work orders, work that can span multiple sessions and extend over a period of weeks or months if necessary.

Some common workflows for using branch versioned datasets include:

  • Multiuser editing, such as individual field crews working in their own branches
  • Modeling a variety of outcomes, with each scenario represented in its own branch
  • Editing and tracking different phases of a project

Set up and share versioned data

If you require multiple editors concurrently accessing services with the ability to work with their own set of edits, you must first register your data as branch versioned. When you share that dataset as a service, you have the option to enable the Version Management capability at the time of publishing, which allows for the creation and management of versions. For more information about setting up a database with branch versioning, see Register a dataset as branch versioned in the ArcGIS Pro documentation.

To edit branch versioned data, you must access it through a feature service. After registering data as branch versioned, publish the data to your organization's ArcGIS Enterprise portal as a web feature layer. Be sure you publish a layer that references registered data. The data will then be available as a feature service and you can edit it as part of your branch versioning workflows. For more information about how to share branch versioned data, see ArcGIS Pro help's Share branch versioned data.

Work with branch versions

The ServiceGeodatabase class represents a hosted geodatabase. You can create an instance of the class by providing the service URI and optionally the version name. You can also read the service geodatabase property from a service feature table.

A ServiceFeatureTable will have an associated ServiceGeodatabase if the feature table was loaded from a web map or if it was created from a service geodatabase (using ServiceGeodatabase.table(withLayerID:)). A standalone service feature table, created using any of the constructors, will not have access to a service geodatabase.

Use ServiceGeodatabase.versions to get information about the versions a service geodatabase contains that the current user has access to. The information includes the name, description, access level (private, protected, or public), creation date, and so on. You can create a new version by providing a name, description, and access level. You can access public and protected versions, and private versions you own. You cannot see information about, or connect to, private versions owned by other users.

The following steps show some common tasks when working with branch versions in a service geodatabase. These include getting the service geodatabase used by a feature layer, getting information about the current version, creating a new version, and switching the version used by the geodatabase to the new one.

  1. Get the service feature table from a feature layer in the map.

    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
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
            // Obtains the service feature table from the layer.
            guard let serviceFeatureTable = featureLayer.featureTable as? ServiceFeatureTable else { return }
    
  2. If the service feature table is not loaded, load it. Then get the service geodatabase from the table. If the service geodatabase exists but is not loaded, then load it.

    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
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
            // Loads the service feature table.
            do {
                try await serviceFeatureTable.load()
                // Gets the service geodatabase from the service feature table.
                if let serviceGeodatabase = serviceFeatureTable.serviceGeodatabase {
                    try await serviceGeodatabase.load()
                    await supportBranchVersioning(serviceGeodatabase: serviceGeodatabase)
                }
            } catch {
                print(error)
            }
    
  3. See if the service geodatabase supports branch versioning. If it does, get a list of its versions and information about the current version.

    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
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
            // Checks that the geodatabase supports branch versioning.
            if serviceGeodatabase.supportsBranchVersioning {
                do {
                    // Gets the service geodatabase's versions.
                    // Versions are named in ascending order which makes the names comparable.
                    let versions = try await serviceGeodatabase.versions
                    guard let currentVersionInfo = versions.first(where: { $0.name < serviceGeodatabase.versionName }) else { return }
                    print(currentVersionInfo)
                    await switchToANewVersion(serviceGeodatabase: serviceGeodatabase)
                } catch {
                    print(error)
                }
            }
    
  4. Create service version parameters that define properties for a new version: a name, description, and access level.

    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
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
            // Creates service version parameters to define a new private version.
            // The ServiceVersionParameters.name must be unique to the geodatabase, otherwise the
            // createVersion method will fail.
            let versionParameters = ServiceVersionParameters()
            versionParameters.access = .private
            versionParameters.name = "ProvideAUniqueName"
            versionParameters.description  = "A new design"
    
  5. Pass the parameters to the service geodatabase to create a new version. Then switch the current version of the database to the new one.

    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
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
            do {
                // Creates a new version of the service geodatabase.
                let newVersion = try await serviceGeodatabase.makeVersion(parameters: versionParameters)
                // Switches the service geodatabase to this new version.
                try await serviceGeodatabase.switchToVersion(named: newVersion.name)
            } catch {
                print(error)
            }
    

Edit data from a branch version

Edits can be made to service feature tables from a branch version in the same way they are made to any ServiceFeatureTable. You can use the same process described in Edit data from a branch version for performing edits when working with a branch version. See Apply edits in a branch version for applying edits to the feature service and posting changes into the default branch. Similarly, navigate to Synchronize edits in a branch version for synchonizing edits to the feature service and posting changes into the default branch.

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