Reference Tag Parent folder


I have a UDT which may contain tags from either a Siemens plc or a Allen bradley.

The udt structure is as follows:

+OPC (Folder)
+Siemens (Folder)
+localtohmi (Folder)
-Testinfolder (OPC tag)
+Allen bradley (Folder)
+localtohmi (Folder)
-Testinfolder (OPC tag)

+localtohmi (Folder)
-Testinfolder (Reference tag)

I have more tags in the udt but this is the structure I have the question about.
At the reference tag i can do the following to get the right tag:

  • [.]…/OPC/{PLCBrand}/localtohmi/{TagName}

However I want to have the folder “localtohmi” to be dynamic.
I know I can read the path to the tag and to the parent folder, but I can not just use only the name of the parent folder. It is possible to do with an expression, but I need the tag to be writable as well.

I want something like this:

  • [.]…/OPC/{PLCBrand}/{[.]}/{TagName}