Getting a folder name using an expression tag for a UDT

Hey Everyone,

I'm having trouble writing an expression to get the folder name to write to a tag. I'm using the famous {[.]../../../..} but its only writing a value of "2" instead of the name of the folder.

Any help would be appreciated!

I would personally save the effort and have it set as a UDT parameter.

But I think adding


to the end will do this for you

Why do you need to do this? Why can you not use the [.]../../SomeTagName within the script where you want to perform the actual write?

You could start with the full tag path and use string functions to pull the part you need. If you know how many folders deep you are this will be easy. If not you should still be able to use string functions based on finding '/' characters from the right side.

EDIT: Would make more sense to start with {PathToParentFolder}. Same general approach applies.

This is for an alarm description. This tag list is auto generated from a JSON object so i just want to grab the folder name to pass into the alarm description. attached is a SS to maybe provide some clarity.

Then make that autogeneration operation place the tag name where you need it. Some things simply should not be done at runtime.