Select to view content in your preferred language

Is it possible to change the version at the feature service level?

446
2
Jump to solution
06-01-2024 03:08 PM
Gurunara
Frequent Contributor

Is it possible to change the version at the feature service level, instead of iterating and changing it at each individual featurelayer level for the current active map?

0 Kudos
1 Solution

Accepted Solutions
Gurunara
Frequent Contributor

MapView.Active.Map.ChangeVersion(fromVersion, toVersion);

View solution in original post

2 Replies
Gurunara
Frequent Contributor

MapView.Active.Map.ChangeVersion(fromVersion, toVersion);

LingrajPani1
Emerging Contributor

Thanks Gurunara. Is it possible to change version of few feature instead of entire map. I want to show feature layer in default version as well as same feature layer in different version.

Below changes the map's version

 

FeatureLayer featureLayer = (FeatureLayer)LayerFactory.Instance.CreateLayer(new Uri(queryUrl), MapView.Active.Map);
featureLayer.SetDefinitionQuery(query);
var dataStore = featureLayer.GetFeatureClass().GetDatastore();
// Create a geodatabase from the feature service URL
Geodatabase geodatabase = dataStore as Geodatabase; //casting to Geodatabase
if (geodatabase == null)
return;
VersionManager versionManager = geodatabase.GetVersionManager();
ArcGIS.Core.Data.Version currentVersion = versionManager.GetCurrentVersion();

//Getting all available versions except the current one
ArcGIS.Core.Data.Version toVersion = versionManager.GetVersion("versionName");

if (toVersion != null)
{
//Changing version
MapView.Active.Map.ChangeVersion(currentVersion, toVersion);
}




0 Kudos