Jump to content

Tag replacement


Martin Pieronek

Recommended Posts

Good afternoon,

Our team is currently migrating our database to a new historian. During this process, we would like to do some clean up on our tag naming convention. This will create an issue for Seeq users that have created a bunch of calculated tags with the old tags in the formulas. Is it possible to write a script that can find these tags and change the formulas?

Example:

HEX-101 Temperature Ref:

$a = DTX.HEX-101.T100.PV

formula: $a + 10

I'd like to find the tag HEX-101, go in and change $a reference from DTX.HEX-101.T100.PV to DTX.HEX-101.Tout-101.PV

Let me know if this is possible.

Thank you.

Link to comment
Share on other sites

  • Seeq Team

Hi Martin, 

You will need the ID of the new tag to swap the tag using Seeq Data Lab. Please see the example below: 

#Search for the calculated tag
metadata_df = spy.search({'ID': 'your_calculated_tag_id'}, all_properties=True) #alternatively, you can search using the name of the tag
metadata_df

#read the formula parameter from the metadata_df
metadata_df['Formula Parameters'][0][0] #you will see the id of the $a parameter for example 'a=F8E053D1-A4D5-4671-9969-1D5D7D4F27DD'

#swap the id of $a in the 'Formula Parameter' of metadata_df with the new id
metadata_df['Formula Parameters'][0][0] = 'a=4E9416E8-9C75-426A-8E0A-4D07432CAC5D'

#push the metadata_df back to Seeq
spy.push(metadata=metadata_df)

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...