Tag Folder Type or Discription? - Other than the tag folder name, are there any tag folder properties that are writable?

Looking for a way to denote a folder type or description. I have a script that can find tags in folders but it doesn't know what that folder is within the process. I need to provide the location when posting the value. That could be the folder the tag was found in or it could be one or two folders above.

I could try to have some kind of case script and a long list of folder names or maybe add letters/numbers to the folder name to denote that the folder name is also the location. Maybe add a memory tag in the folder and if found used to pass the location name.

I didn't want to have to add tags or mess with the displayed tag folder names if there was a better way.

I did find that I can read the cfgVersion property of the tag folder but I'm unable to change it directly. You can write a value to it, but whatever value you write just increments it. Could maybe do something with that but it seems to reset if you restart the gateway.

Have you tried using system.tag.configure() in merge mode to set a custom property on the folder?

{ I'm guessing.... }

I wouldn't expect the tag browser to show it, but an explicit read of path/to/tag/folder.someprop should work.

Thanks, that seems to work. No way to remove a property after adding one I'm guessing?

It's too bad you can't just double click (Edit tags(s)) on the folder to see and change the properties like you can a tag.

1 Like

You can do the same thing to remove or change properties, so long as the collision policy is set to overwrite (the default).

Ok, I'll give it a try in the morning. It just looked like some other HMI database type stuff where you can tell it not to change it, if already there or add it if not there or update it. No way to say if it is there remove it, not just make it blank, "".

I used this to create it:

baseTagPath = "[default]..."
folder = [
            {
                "name": "foldername",	        #Name of folder to update Property
                "newProperty":"locationIs"	#New or Property update.
            }
        ]
system.tag.configure(baseTagPath, folder, "m")

If I do the same with a blank vale and overwrite, wouldn't still be there?

baseTagPath = "[default]..."
folder = [
            {
                "name": "foldername",	        #Name of folder to update Property
                "newProperty":""	                #New or Property update.
            }
        ]
system.tag.configure(baseTagPath, folder, "o")

With overwrite, folder would need to include all properties, any not included will be removed?

If you did the as you have shown the property would still be there, it would just have a different value. In this case and Empty String.

To remove the property it needs to not be included, name or value, in the configuration.

Change Value:

folder = [
            {
                "name":"foldername",
                "newProperty":newValue
            }
       ]

Remove Property:

folder = [
            {
                "name":"foldername"
            }
       ]

That's where I was headed. I was just wondering how it knows which ones not to delete. Just any that have been added and did not exist by default? It's not going to delete everything else right?

So long as the configuration include the TagType and Name it should continue to function as it always has. If you're concerned about loosing information, which is possible, then use system.tag.getConfiguration() first to retrieve the configuration, then you can modify it to fit your needs.

NOTE: system.tag.getConfiguration() will only return non-default properties. It should work for your purposes however.

2 Likes