Math plus +function in Kano code is appending vs. adding numbers. Instead of doing a math function like the others -, /, * it appends numbers like 1+2 = 12 instead of 3. I am working with numbers from clock module like adding to a hour to make a different time. Working on a clock display since there is no rtc the time is always displayed as UTC.
Could you share with us which kano app/kit you’re using, on which device, with which OS?
Also a screenshot or two would be of great help.
I am using the computer touch kit with Kano code. If I try to add a number to information from the clock it appends like it thinks it is appending text instead of adding numbers in a math function.
Actually at the moment I am working on this project on my laptop but will be using it on my computer touch.
Could you link to the project you’re working on so the community can offer advice?
@pfeifer - https://world.kano.me/creation/my-clock-1 this is the same project as my other post. My workaround is to use sliders to create numbers that I can add to input from the clock to create a new time. I’m not using the + feature in the way that has the problem. You may replicate it by taking hour from the clock and adding a number to it and show the result as text or use text input to add to hour from clock. Since the touch computer doesn’t have a real time clock, RTC I’m trying to make a date, time display that can be adjusted to display any time zone, vs. UTC that the computer syncs to. Major work to get hours, days, months and years to role over properly when setting to different zones.
just ran a test, adding a number as a fixed variable works but adding a text input treats it like appending text instead off adding. It looks like there should be a number input function or a way to specify if input is text or numeric so it can be handled appropriately. Some projects may rely on appending numbers as text vs. adding as numbers. My clock project uses sliders to change values added to hour to create time for different time zones. Another issue is subtracting time doesn’t work if the result is negative, which on a clock would revert to the previous day, month, year.
I see you get the data from a text input. The text input will give you a string, when this variable is given to the math operator, it will check the type and decide to concatenate instead of adding. You need to find a way to make that string a number.
I figured out you can use the
round block. If you give it a string it will cast it to a number, then all your math operations will work
Thanks, makes sense. There probably should be a separate number input form for entering them. Also more blocks maybe in the clock function for performing time and date math. I’m programming time display adjustable for all time zones.