Expression Tag reference self?

Hi,

Is there a way to get an expression tags own name within its own expression?

I’ve tried things like

[.].Name
[.].name
{[.]}.Name
{[.]}.name
tag([.])+’.Name’
tag([.])+’.name’
tag({[.]})+’.Name’
tag({[.]})+’.name’
tag({[.]}+’.Name’)
tag({[.]}+’.name’)

But all fails…

Thanks

Use this

{[.]nameOfYourTagHere.Name}

Thanks, but I was hoping for a solution where I wouldn’t need the actual name of the tag.
Do you know if that’s possible?

It’s not possible, at least not in v7.9. I’ve been meaning to check what is exposed in v8’s expression tags by my objectScript() function’s binding argument. The new tag group functionality suggests it won’t be null.

Ok, thanks

Great function, @pturmel, but I noticed that your objectScript() doesn’t trigger when the values change.

For example, I’ve got the following code on the background color of a numeric text input field:

if(objectScript("binding.target.floatValue") < objectScript("binding.target.minimum"),
	"Red", "White")

But when the values change (either when written from the input field, or read from source), the script doesn’t appear to run. When I change it to the following:

if({Root Container.Numeric Text Field 5.floatValue} < {Root Container.Numeric Text Field 5.minimum},
	"Red", "White")

then it functions as expected, triggering whenever the values update.

Any suggestions?

Expected and unavoidable behavior, just like with runScript(). binding.target is intended for values you can’t get to any other way, or you deliberately want to exclude from re-triggering. Use the args feature to pass dynamic values to the python expression.

Keep in mind that both runScript and objectScript have overhead from starting a python environment that pure expressions do not. Use them where other techniques are insufficient, and especially avoid changing the python expression string itself.

Fair enough. Thanks.

I found there’s now a way to do this: Reference self in tag expression?

Use {this.name} :slight_smile:

2 Likes

Very cool :slight_smile:

Oh wait, that was from my post… Haha, I’d completely forgotten about this

2 Likes

Thanks Bryan and by extension nminchin :ok_hand: I can’t remember why I needed it anymore :laughing:
But good to have it for later I guess!