You are better off creating a flat list of Elements - and use that for Tag creation.
Once you have the Elements, use Element references to create Element hierarchies - I'm sure you'll need more than one hierarchy. AFBuilder can speed things up.
I use a similar setup, where i have up to 7-8 levels in my hierarchy, and the lowest element in the hierarchy actually holds the Attributes that link to the PI Points. The PI Points need to have a name that reflect the position in the hierarchy.
On each element (hurray to template inheritance!) i have e.g. an attribute called 'codename' containing the Pointcoding-part from that element, and on every element i have an attribute called 'code' that is the concatenation of the parent element attribute 'code' and the 'codename' of the current element. This effectively adds the codename attribute each level down to that from the parent. Unfortunately, AF does not support strings in formula's. I solved this by creating the StringConcat DataReference (see code examples for custom datarefences) which lets me concatenate the parts.
Level Element codename code 1 Plant P21 P21 2 Process DZ4 P21-DZ4 3 Unit PG12 P21-DZ4-PG12
Hope this helps!
Thanks Gopal and Roger,
I've used the flat elements approach, works out well.
Interesting approach of the data reference model, i will take a look on that further.