Page 1 of 1

i cant retrieve a value from local Storage and perform arithmetic on it. it comes up as NaN

Posted: Sun Jun 07, 2015 6:36 am
by LuisMa Suárez Gutiérrez

I'm sending several values to Local storage via "set storage variable" action using "bind to component" to a label's text element.

but then i try to retrieve from local storage and i cant because it cant parseInt().

when i look at the debug tools, i see something like " "0" " when the variable is a number, but if it is text, it doesnt have qoutation marks.

why?
Image

in the image below, when i click the checkmark ( black ink) i send the number of available invitations ( blue ink) and the number of used invitations (red ink) to local storage.

immediately after i try something similar to

var invitations=parseInt( localStorage.getItem('invitations_lsv') );

var used=parseInt( localStorage.getItem('used_lsv') );

if ( invitations used ) then used++; //this is a check-in

i can never compare as i always get a NaN

why??

Image


i cant retrieve a value from local Storage and perform arithmetic on it. it comes up as NaN

Posted: Sun Jun 07, 2015 10:13 am
by Illya Stepanov

Hi -

[quote:]
I'm sending several values to Local storage via "set storage variable" action using "bind to component" to a label's text element.
[/quote]

Could you please show how exactly you make this in builder and with what components?