Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X
Is there any way that i can store the state of this parameter in expression. I dont have anything to bind it from my mashup. So in the screenshot you can see that i have bool which has default value true and i just want it to change every time i use this function. For example I change the state to false then again next time i evaluate i turn it into true.
Solved! Go to Solution.
To store and reuse the computed value, you can try
a) a Checkbox you make invisible
b) a Mashup parameter
c) a Session variable
I create an expression
Expression detials
I have created a mashup parameter named status. Its a checkbox and i have selected it with true and i change it everytime i run this expression so i change it to true and false
mashup parameter
Now the problem is i get in console.log no value neither true nor false. it shows me empty space in console.log. can you see whats an issue?
Maybe try to assign a value when opening the mashup first to debug. You can also log something on the event of statusChanged which should be there on the mashup.
It can be it does not work with mashup parameters. Options a) and c) are sure shots though.
My bindings are below:-
I have a checkbox with state by default i have selected true.
Still it does not work and not even returning anything but on mashup it needs to fill the checkbox but it is not even filled as by default i have selected it true.
what can be the cause?
If i select the checkbox manually on mashup and then run the expression it returns true and again true if i execute again. its not changing to false true .....
Try this setting in Expression
I would also extend the expression to account for undefined value (e.g. assign false then).
I tried and now the output is coming but the topic here is i want to switch it to true and false and again on every execution the state will change to true and then false. right now its just making it false false false. i want to switch the state because i have used EVENT ROUTER and its input i want to change everytime to refresh something. if it stays like this it will not work.
Interesting, good to know. I guess this is why the recommendation is to use TW.log.debug for logging. https://support.ptc.com/help/thingworx/platform/r9/en/#page/ThingWorx/Help/Mashup_Builder/Migration/BestPracticesExpressions.html
I guess the console.log somehow messes with the Output variable.
Note that the expression also has a Changed event, so maybe you don't need another event router.
Thanks for recommendation.
I am sending the result into another mashup and there i am getting this true false to refresh the mashup via mashup parameter thats why i cannot use changed event in this mashup directly because i want it into another mashup not in the same mashup where i have implemented this EXPRESSION.