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
I'm sorry for the question (maybe stupid) but I'm very new with ThingWorx.
I have a thing shape, thing template and 25 things with some properties. Let's call the properties Alpha, Beta, Gamma.
I guess I must use some Javascript into the Snippets but I'd be glad if you could give me an help while I try to see by myself
Solved! Go to Solution.
Hi Fabio,
On server side Javascript:
Hi Fabio,
On server side Javascript:
Thanks for your help but since I'm very new with Thingworx I don't know if I understood it all.
I write here all the steps I've done and if you can tell me what's wrong I'd be glad.
Ok. I (almost) did it.
I'll write here all the detail
I just have some more doubts.
Thank you very much for your help
On the subscription you should set the properties in order to se the values changing on the property:
me.Alpha = values.A;
me.Betha = values.B;
To do 2, you should change your code:
me.Alpha = Math.floor(Math.random()*100)+1;
me.Betha = me.Betha +5;
then set values.A and values.B with the previous values:
values.A = me.Alpha;
values.B = me.Betha;
3. Properties doesn't support formulas, you should write a service which does the job.
If it's a Value Stream, the history recording it's done "automagically", you don't need to create values neither insert it just update the properties.
You need to assign the Value Stream ("EvolutionProcessValueSTream" ) to thing Ev-Th1 ( or to the EvolutionTemplate), and then set Alpha, Beta and Gamma as logged properties
Ok so, you're saying that my process is fine until 5 then you say to create a Value Stream instead of a Stream, am I right?
And one more question: if I don't have to create values or insert them into the properties, how can I "tell" my thing that its property alpha has to change randomly every 5 seconds?
Value Stream it's a "container" for logged properties, once created the Thing type ValueStream you should assign it to the Thing where you have logged properties.
About changing alpha property, you should change it setting it's value as I said on my first post through a Timer thing which triggers every 5 seconds.