Problem with infinty loop need help
my target is
1. calculate the temp max and temp min in day.
I got the logic how to do it
2. Plotting it over chart
This has an issue. when am trying to plot on chart it is having mulitple temp_max , temp_min on the same day
which is wrong
3. to solve the above problem i came up with a logic again that temp_max , temp_min will only be update at 6PM daily so that i can avoid multiple recordings in a same day
for this i came up with a logic and tried to implement it. But am not sure how to acheive this in thingworx
here is the code snippet i wrote
var count = 0 // count for il do 6 times but i wont update the temp_max, temp_min
while (1)
{
me.temperature = Math.floor((Math.random() * 50) - 10); am getting the random temp value
count++;
if (count == 1) at count 1 both temp_max, temp_min will be equal to temperature
{
me.temp_min = me.temperature ;
me.temp_max = me.temperature;
}
if(me.temperature <= me.temp_min)
{
me.temp_min = me.temperature ;
}
if (me.temperature >= me.temp_max)
{
me.temp_max = me.temperature ;
}
if (count == 6)
{
var result = me.temp_min;
var result = me.temp_max;
count=0;
}
}
I tried to run this on shell and acheive what i want

if u see in the script at 6th count the values are being set for that particular day
and next the counter sets to zero and again it will be triggered later
please and kindly help me how to acheive this in thingworx

