# Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions Problem Scale expression… what i’m wrong?

• # Problem Scale expression… what i’m wrong?

2 Members · 3 Posts
• ### Dimitri Bertolini

April 23, 2021 at 2:34 pm

Hi all!

This is my first time I post here, but I followed you for a very long time.

I have a problem with a (simple?) expression.

I need to link a layer’s Scale to a Null Scale. I need that, if the scale of null is bigger than 100, mi main layer is that value -15, while if the value of null is 100 or less, my layer is the value of null.

I have used an else if function (ok, I could use a simple if-else, but the problem still remains), but it always returns me a problem on a variable.

what’s I wrong?

This is the problem:

`sc = thisComp.layer("SCALA_SECONDA_PARTE").transform.scale; // Error: undefined value used in expression (could be an out of range array subscript?)vaX = transform.scale[0];vaY = transform.scale[1];scHigh = sc-15;if (sc == 100) {	[vaX,vaY]} else if (sc <100) {	[scHigh,scHigh]} else if (sc<100) {	[sc,sc]}`

I tried to write it pointing only one dimension of the null’s scale (sc = thisComp.layer(“SCALA_SECONDA_PARTE”).transform.scale[0]; , and again, same error.

I’m still learning the expressions, so thank all for your help! 🙂

• ### Dan Ebberts

April 23, 2021 at 6:16 pm

This should work:

`sc = thisComp.layer("SCALA_SECONDA_PARTE").transform.scale;sc[0] > 100 ? sc - [15,15] : sc`
• ### Dimitri Bertolini

May 5, 2021 at 10:21 am

Thanks Dan!

This worked perfectly! 🙏

Viewing 1 - 3 of 3 posts