Calculate new creator field values using old creator field (editor tracking fields)

765
5
Jump to solution
02-08-2023 07:24 AM
Labels (2)
HeatherBell
Occasional Contributor

Hi, I'm really hoping someone can help with this. 

I need to change the values in the creator field of a feature layer. I have uploaded some data which has created a new creator field for editor tracking and replaced this all with the one username which uploaded the data. I need to calculate the values in new creator field using the values in old creator field.

After this, I will use the other notebook which I have found to edit the creators to the updated community licences which we have - see attached code from another forum post.

I'm hoping its quite simple and the code attached already has the part about unlocking the editor tracking fields, but I would really appreciate if anyone is able to advise on what I think is a simple field calculation. See the image below. 

Thank you,

HeatherBell_0-1675869479125.png

 

Heather.

GIS Analyst @ The Rivers Trust
0 Kudos
1 Solution

Accepted Solutions
HeatherBell
Occasional Contributor

To anyone following this post in future, I've attached the solution script which myself and my colleague wrote based on the other script mentioned above which worked for this process. Hope this helps someone else. 

Best wishes, 

Heather. 

GIS Analyst @ The Rivers Trust

View solution in original post

0 Kudos
5 Replies
jcarlson
MVP Esteemed Contributor

The editor tracking fields are, by nature, internally managed and not directly editable. The entire point of editor tracking is for data integrity, and being able to manipulate this field would defeat the purpose.

If you really wanted to, you can change the user listed in the creator field this way:

  1. Import the layer into an offline geodatabase
  2. Make sure editor tracking is disabled
  3. Calculate the creator field as needed
  4. Enable editor tracking, selecting the right creator field
  5. Publish the layer

The published layer should have retained the values from the geodatabase. Once published, however, there is no way to make further changes to it.

- Josh Carlson
Kendall County GIS
0 Kudos
HeatherBell
Occasional Contributor

Hi @jcarlson

Thank you for your reply. I'm afraid this workflow won't work for me as I need to be able to do this with the live feature layer. The user case is staff turnover where we use OBAC (ownership based access control). 

I know that it is possible to unlock the editor tracking fields such as the 'creator' field. This is demonstrated in this thread here: https://community.esri.com/t5/arcgis-online-blog/updating-editor-tracking-data-in-a-hosted-feature/b... and the script attached to the orginal post which I have tested. 

However, what I need to be able to do, is do a more simple field calculation from the old field to the new field. 

Best wishes, 

Heather. 

P.s I think @ScottMoore__Olympia_ no longer uses his account, but he wrote the attached script which I have tested and does work - does anyone else have any pointers? Thank you. 

GIS Analyst @ The Rivers Trust
0 Kudos
HeatherBell
Occasional Contributor

Hi @jcarlson

Thank you for your reply. I am afraid this will not work for my workflow. It is possible to unlock the 'creator' field with the user case being staff turnover when using OBAC (ownership based access control). I have tested the script attached and this works to unlock and edit this field. See this post here.

However, I need to copy all of the rows from the original creator field into the new creator field instead. 

I don't if ScottMoore__Olympia_ still works at Esri, but do you or anyone have any pointers? Thank you very much. 

Best wishes,

Heather.

GIS Analyst @ The Rivers Trust
0 Kudos
jcarlson
MVP Esteemed Contributor

Oh! I didn't know that was actually possible, but I suppose it makes sense for admins to be able to do that.

Well, when you're using the calculate method on a feature service, you can just insert another field name. So where Scott Moore is putting a static string into the expression, you could just put the other field name, and it will update the one with the contents of the other.

- Josh Carlson
Kendall County GIS
0 Kudos
HeatherBell
Occasional Contributor

To anyone following this post in future, I've attached the solution script which myself and my colleague wrote based on the other script mentioned above which worked for this process. Hope this helps someone else. 

Best wishes, 

Heather. 

GIS Analyst @ The Rivers Trust
0 Kudos