Select to view content in your preferred language

Retrieving features from a specific database version

768
4
05-15-2023 06:24 AM
StefanAngerer
Regular Contributor

Hi folks,

Question: I'm trying to figure out if it's possible to check if a feature is in the default version of an ArcGIS database via Arc Arcade and Attribute Rules. Basically, if a feature is in the default version, I want to prevent it from being deleted. But if it's not there, I want to be able to delete it.

Can I retrieve certain features that are only available in a specific version of the database? If not, any ideas on how to achieve this behavior?

Thanks for any help!

Cheers,

Stefan

0 Kudos
4 Replies
AmirBar-Maor
Esri Regular Contributor

@StefanAngerer 

This expression will constrain edits in the default version:

// Constrain editing the 'sde.DEFAULT' version
return !(GdbVersion($feature)=='sde.DEFAULT');

 

You can also enhance it by only limiting certain portal groups from editing the 'Default' version.

This is how you can find the groups the user belongs to:

// find which groups a portal user belongs to. Returns an array.
var myPortal = Portal("https://galileo.esri.com/portal/");
var currentUser = getuser(myPortal);
return currentUser.groups
0 Kudos
StefanAngerer
Regular Contributor

@AmirBar-MaorThanks for the quick help. However I guess I didn't ask my question properly. My use case is that a potential editor makes edits in a specific version of a database. And in this specific version, I want the editor to not be able to delete features that are available in the sde.default version. Its important to know that in our process we copy all the features of sde default into the new database version in order to also edit those feature. however an editor should not be able to delete a feature that was copied from sde.default. I thought the best way to tackle this is to check if a feature is also available in the sde.default version, and if it is, hinder the deletion process. Does this make any sense?

Greets!

0 Kudos
AmirBar-Maor
Esri Regular Contributor

@StefanAngerer 

I don't consider myself as an Arcade expert... to the best of my knowledge that is not possible to check the state of the feature on 2 different versions using Arcade. I'll be happy to be corrected by the gurus.


Potential workaround:

If you had a field and an attribute on the features in the Default version, e.g. a 'status' field and a value 'approved', you could constrain deleting such features using the attributes they hold.
You can also think of a calculation rule that sets a field value if the feature made it to default.

StefanAngerer
Regular Contributor

@AmirBar-Maor 

Alright! Thanks for your help. For now I would keep this question open if somebody else has an idea how to tackle that functionality with AR. In the meantime I will try to find a workaround with your idea 🙂

0 Kudos