Page 1 of 1

A few questions about working with numbers

Posted: Fri Dec 07, 2012 2:59 pm
by wwat
Is this the best method to display a number in a text object?
1) create a text object on the canvas
2) create a label variable
3) set the text objects dynamic label property to the label variable
3) create a number variable
4) set the value of the label variable to the number by placing [NameOfNumberVariable]
in a set label action

The other question relates to calculations on numbers. Is it possible to do some division on numbers.
i.e the actual temperature sent from the ISY is double the actual temperature so you have to
divide by two to get to the actual. A number of 148 is actually 74 degrees so I have to have a way to
divide the number by 2.

Thanks Wayne

Re: A few questions about working with numbers

Posted: Fri Dec 07, 2012 3:13 pm
by DemoPad
Yes - that is the way to display your number variable as text.

As for dividing, we've only put in [+] and [-] as operations at the minute, but the next version of the app supports [*] and [/] for multiplication/division.

Re: A few questions about working with numbers

Posted: Fri Dec 07, 2012 4:03 pm
by wwat
> but the next version of the app supports [*] and [/] for multiplication/division.

Phenomenal, Many thanks.

Re: A few questions about working with numbers

Posted: Fri Mar 03, 2017 11:47 am
by AKWillows
This is an old thread, but reviving as I have a question re dividing the value of numbers

So, I capture a number into a number variable which I would like to divide by 1000 and then display.

This is the way I have it set up at the moment, but it behaves irratically - sometimes the divide by 1000 happens twice, sometimes it doesn't happen, sometimes a zero is displayed

1) Capture value into "Number 1"
2) Action 1: Type Set a number Number Number 1 Data: [/]1000
3) Action 2: Type Set a label Label Label 1 Data {Number 1}
4) Display Label 1 on the page

I also tried the division being targetted to a second number

1) Capture value into "Number 1"
2) Action 1: Type Set a number Number Number 2 Data: {Number 1}[/]1000
3) Action 2: Type Set a label Label Label 1 Data {Number 2}
4) Display Label 1 on the page

But this resulted in a zero being displayed all of the time.

Any thoughts on where I am going wrong please?

Re: A few questions about working with numbers

Posted: Sat Mar 04, 2017 10:54 am
by DemoPad
Try putting a slight delay on those actions - to give the feedback routine time to assign the captured value to the number.

Re: A few questions about working with numbers

Posted: Sun Mar 05, 2017 7:09 pm
by asimp11
I have found that a delay of 0.2 or 0.3 seconds works best for serial (RS232) feedback but for IP feedback it can get missed if you have a lot of network traffic. Feedback sent from your 3rd party device will not buffer, if it is squashed by another command it will most likely display default. Mind the gap!!