Getting cloud data correctly?

Now that I have the on boarding sequence into Firebase, I’m trying to display that data on a screen. But I’m getting a null value back.

How far off am I with my blocks?

I was looking at this example: Replace GET or SAVE Blocks with cloud variables

What I’m trying to do is pull numbers to do simple calculations from the onboarding sequence to create workouts for each day.

So if someone does 50 pulsations from the onboarding questions the equation would be 50 divided by 4 rounded to the nearest whole number which would be 13 reps.

In this example I’m trying to return age so I can get the data retrieval right.


That looks like it should work but I don’t see the point of using cloud variable age. You’re telling Thunkable to get a value from Firebase and then store it back in Firebase under a different key name. I would change cloud variable age to app variable age. It will also speed up your code because accessing cloud variables is a little slower.

To simplify this (for now), just set Label31’s Text to cloud variable [join] “onboarding/Step1/age” and see if that works.

Hey, like this? It’s returning null

Yes, like that. You don’t technically need the join block… I just included it because you had it set up that way before with multiple text blocks.

Can you export your JSON from the Firebase console and post it here as text? You shouldn’t be getting null unless something is wrong with your path to the data or your access rules in Firebase aren’t allowing reading. You can test the rules in Firebase. If it’s a new Firebase database (<30 days old), the rules shouldn’t be causing this.

My rules are set to the following. At first I had read set to false. But when I change them both to true, it stops writing anything to the database during the onboarding sequence.

  "Date": "Jan 10, 2023",
  "Exhale": "28",
  "Inhale": "Label",
  "Result": 0.7142857142857143,
  "name": "onboarding/Step1/age",
  "null": "onboarding/Step1/age",
  "users": {
    "fixPhase": {
      "Exhale": "31",
      "Inhale": "32",
      "Result": "33%"
    "onboarding": {
      "Step1": {
        "Gender": [
        "age": "2333",
        "athleticismTraining": [
        "bodytype": [
          "Lean / Lanky",
          "Sturdy / Heavy"
        "date": "Jan 2, 2023",
        "intensityTraining": [
          "Not Active",
          "Exercise Sometimes",
          "Exercise Regularly",
          "Exercise Vigorously"
        "locationMotion": [
        "name": "333"
      "Step2": {
        "Exhale": "28",
        "Inhale": "30",
        "Result": "72%"
      "Step3": {
        "runningDistance": "30",
        "runningTime": "02:23:23",
        "swimmingDistance": "20",
        "swimmingTime": "01:23:45"
      "Step4": {
        "balloons": "6",
        "bellow breaths": "6",
        "droppickitups": "3",
        "extended exhale 1": "1",
        "extended exhale 2": "3",
        "extended exhale 3": "7",
        "extended exhale 4": "4",
        "meditation": "20",
        "o2trainer": "5",
        "pulsations": "2"
      "Step5": {
        "anxietyLevel": "3",
        "bloodPressure": "2",
        "brainFog": "3",
        "breathlessness": "4",
        "cravings": "5",
        "digestiveProblems": "3",
        "disturbedSleep": "5",
        "fatigue": "3",
        "lowerBackPain": "1",
        "neckDiscomfort": "3",
        "other": "5",
        "pain": "10",
        "restingHeartRate": "110",
        "stress": "2"
1 Like

I re-formatted the JSON using the Preformatted text symbol (</>) in the toolbar. That removes smart quotes which by default invalidate JSON. After that, I copied and pasted it into so I could see the JSON tree structure.

My assumption was that there might be paths (keys) before “onboarding” and I was right. When I click on “age” on that website, it shows me the path to it at the top (object → users → onboarding → Step1 → age):

You’re only providing part of the path to the “age” key which is why Thunkable can’t find data there. The full path is “users/onboarding/Step1/age”.

1 Like

agh, that makes sense. I was able to return the result 2333.

Any idea why setting the read to true stops anything from posting to the database. If I change read to false i can post to the database

No, that’s very strange!

Weird, I’ll maybe reset the API key. Thanks for your help once again!

One follow-up on this. You mention doing app variable instead of cloud variables because they are quicker to get data.

What do i need to change in my blocks to use app variable? The pulsation number is pulling from Firebase

You do need to use a cloud variable when setting or getting data from Firebase. So that screenshot is correct. In your earlier screenshot, you were setting a cloud variable to another cloud variable. There aren’t that many instances where you would need that. And if you did need to, you would set cloud variable [path] to cloud variable [path] to copy the value to another key.

The reason to use app variables is if you need to display or use the values throughout your code and don’t want cloud variables to slow it down. So instead of constantly having to call Firebase to get the value, you just get it once, store it in an app variable and then use that variable throughout your code until/unless you need to save a new value to Firebase.

But again, what you have in your screenshot is fine. Just a note that you can round up the division result if you want to remove a few blocks. :wink:

Thank you for clarifying that! I’ll try that

You’re awesome!

1 Like