Fred McIntyre
Posts: 0
Joined: Sun Jan 12, 2014 5:04 pm

set boolean storage variable in new Builder UI (as of 9/22/2014)

In the Project Storage and Models Storage when adding a storage variable I can set the type to Boolean.

When setting a storage variable in an Event (on Design page) or in Data, it would be good if the "Value" field were a drop down with True and False as the selections. In fact, to be able to use them in Javascript as boolean this is essential.

For example, I have a storage variable named "loggedIn" designated as Boolean. In the Design Events I added a "Page show" Event with Action "Set storage variable" and I typed in "false" (without the quotes).

Then, in a following "Page show" Event I have Action "Run JavaScript" and my script is:
preif (Apperyio.storage.loggedIn.get()) {
alert('value of loggedIn '+Apperyio.storage.loggedIn.get());
}/pre
the alert says "value of loggedIn false" but there should not have been an alert at all.

A Boolean with a value of false should fail that "if" statement.

In fact, if I typed in "true" and have
preif (Apperyio.storage.loggedIn.get() === true) {/pre
the "if" is evaluated as false.

I find I have to use
preif (Apperyio.storage.loggedIn.get() === 'true') {

and

if (!Apperyio.storage.loggedIn.get() === 'true') {
or
if (Apperyio.storage.loggedIn.get() === 'false') {

/pre

That is not how boolean values are supposed to work.

Or, perhaps I should be typing in something other than "true" and "false" for the value of a boolean storage variable.

Fred McIntyre
Posts: 0
Joined: Sun Jan 12, 2014 5:04 pm

set boolean storage variable in new Builder UI (as of 9/22/2014)

Update: I have found that I can leave the value blank for "false" and type in anything for '"true" - but a drop down with True and False would be better.

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

set boolean storage variable in new Builder UI (as of 9/22/2014)

Hi Fred,

Thank you for the feedback.
Please let us know if you need any help.

Return to “Issues”