cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Expression auto evaluate

jensc
17-Peridot

Expression auto evaluate

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.

1 ACCEPTED SOLUTION

Accepted Solutions
jensc
17-Peridot
(To: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

View solution in original post

5 REPLIES 5
jensc
17-Peridot
(To: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

Sathishkumar_C_0-1676468880476.png

ALWAYS - Expression executed every time regardless of data change

VALUE - Only at any Input data change

 

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

 

Thanks for the Thingworx entities.

I believe  is based on the input data. I'm seeing no inputs created in both the expressions.

 

Hello,

 

Yeah, so the only way to trigger it is if there is some data input, or by the event trigger.

I'm not sure why, but I had the imagination that if I had the Auto Evaluate active, it would get triggered by any load event.

 

I'll just trigger it by the mashup load event and it will work fine.

 

Thanks for your input!

Jens

Top Tags