Firebase storing values as strings instead of booleans


Hello everyone,

I’ve noticed that data slots are of type “text” or “image” but I’m wondering if there is any plan to support booleans. I have some values that I sync with Firebase which are then used to display things on a react native app which is using the same firebase back end. I’ve noticed that when I set the values as “true” or “false,” they are then set in Firebase as strings (i.e. “true” or “false”) instead of booleans (i.e true or false). Is this something you may add to the product?

I figure there is also probably a script that I could write to work around it, maybe something like this:

var checkboxText = this.props.fieldisActiveCheckbox;
if (checkboxText == 'true'){input.isActive = true};
if (checkboxText == 'false'){input.isActive = false};
return input;

…but that doesn’t seem to work. Any ideas? Thanks all. -Taylor


By default the Send data interaction will use strings. With script you can bypass this behaviour. See screenshot:

You just need to check the data slot value or checkbox state and toggle true/false in the script.

For retrieving true/false from Firebase you can link the checkbox’s “Selected” prop to boolean Firestore document field it will work. See how it works on my test project:


Thanks you Antti! I knew there was a solution.

I guess I have two follow up questions:

  1. How do I get the checkbox state or a value from the component field? (Or which video should I watch in order to learn this?)
  2. Can I convert strings to integers in a similar sort of way? How about queries into arrays or objects? (Again, all for the sake of getting things into a format that my react native app can work with.)

Sorry for all the questions - I just don’t know which videos to watch to learn everything there is to learn about your great product!


I figured out how to get the checkbox state… but it kept wanting to go back to being a string, so I went a little crazy to keep it a boolean:

if(this.state.field_isActiveCheckbox === "true" || 
this.state.field_isActiveCheckbox === true ||
this.state.field_isActiveCheckbox === "1")

if(this.state.field_isActiveCheckbox === "false" || 
this.state.field_isActiveCheckbox === false ||
this.state.field_isActiveCheckbox === "0")

return input;

But I would still love to know your thoughts on question 2. :slight_smile:


You can manipulate the input object (document to be added into Database) completely in the save data script.

E.g. something like this:

input.firstname="John Doe"; //string
input.age=22; //integer
input.isActive: true; //boolean
input.arrayExample: [5, true, 'hello'] //array

So the main idea is that the input is the object you’re adding into Database.


Thank you for the explanation, Antti!!