Skip to main content
17-Peridot
February 15, 2023
Solved

Expression auto evaluate

  • February 15, 2023
  • 1 reply
  • 2456 views

Hello,

 

I am having some problems with the auto evaluation of my expressions.

One is working fine, evaluating automatically (with no event trigger).

But the other one is not evaluating.

 

They are pretty much the same expression, however one of them have some input bound:

jensc_0-1676452197649.png

 

Both have these settings:

jensc_1-1676452235884.png

 

The code is just some logging (have tested with using event trigger and they both work, logging to console as they are supposed to.

 

Code:

Working expression:

jensc_3-1676452375665.png

 

Not working expression:

jensc_2-1676452350626.png

 

Am I missing something with the functionality of the expression function?

Anyone else that have had similar issues?

 

I have tried this on 9.1 and 9.3, both seem to behave in the same way.

Best answer by jensc

Hello,

 

I found why this is happening so I thought I'd share it incase someone else wonders about the same thing.

On PTC's Help Center there is some documentation regarding the Expression function: link

 

The important part for this is:

• Auto Evaluate—Evaluates the expressions automatically when input parameter data is changed.

 

My understanding is that this means that the expression function can be triggered by the data changed event of its inputs.

 

Thanks,

Jens

1 reply

jensc17-PeridotAuthorAnswer
17-Peridot
February 15, 2023

Hello,

 

I found why this is happening so I thought I'd share it incase someone else wonders about the same thing.

On PTC's Help Center there is some documentation regarding the Expression function: link

 

The important part for this is:

• Auto Evaluate—Evaluates the expressions automatically when input parameter data is changed.

 

My understanding is that this means that the expression function can be triggered by the data changed event of its inputs.

 

Thanks,

Jens

17-Peridot
February 15, 2023

Sathishkumar_C_0-1676468880476.png

ALWAYS - Expression executed every time regardless of data change

VALUE - Only at any Input data change

 

jensc17-PeridotAuthor
17-Peridot
February 15, 2023

Hello,

 

I just tested it in a fresh 9.1 mashup (attached if you want to test it out) and it doesn't work.

You will find two expressions, Expression1 and Expression2:

jensc_0-1676469587318.png

Both have the same consol.log in them, one has data change type set to always while the other one has it set to value:

jensc_1-1676469614089.png

And as I said, neither works.

I added a button to make sure they work as well.

 

So if you can spot something I did wrong I'd be very happy!

 

Thanks,

Jens