Expression Tag - Expression with Tags Path

Hello,

I have the same name expression tags in different id folders. Is it possible to extract the expression tags path for use within the expression? If possible, would mean I could copy and past the tag into a different id folder and it would work without edit.

If the tags referenced are in the same folder as the expression, the [.] provider notation, possibly also with relative folder paths, should suffice. Do you have an example?

Hi Phil, hard for me to provide an example without spending too much time. I guess the simpler question is, can I have an expression tag (string) within a folder who's value is the name of its parent folder?

No. UDT instances have such. But seriously, look at the relative path options. Anything else for expression tags needs the use of the tag() expression function.

2 Likes

Huh. This works:

objectScript("binding.expressionTagPath")

This yields just the containing folder:

objectScript("binding.expressionTagPath.parentPath")

Hmm... I pasted that into my expression tag's expression but it is saying 'Error_Configuration'

You need my Simulation Aids module installed. I would use event driven mode on that, so it only evaluates on tag startup/restart.

1 Like

Seconding the UDT idea. It's very easy to implement, just create a UDT that contains an expression tag. {PathToParentFolder} will get you the path including the UDT name, and you can use string operations to strip the last part out.

left(
	{PathToParentFolder},
	lastIndexOf({PathToParentFolder},'/')
)

image

Blegh. I was trying to guide @dion.botha away from creating a UDT. UDTs are pretty heavy-weight constructs. The Right Answer™ is relative paths. UDTs are wonderful, but not for this.

1 Like

Ah, my mistake. Is the concern about memory or processing load? I've used UDTs heavily without issue, but I have to admit that it's always been for small scale applications.

s/or/and/

and avoiding the tag() function (can't always, for expression tags, but should be avoided as much as possible).

and balancing original convenience against maintainability and flexibility.

1 Like