# How to make extract

**URL:** <https://community.thunkable.com/t/how-to-make-extract/2742209>\
**Category:** Questions about Thunkable X\
**Created:** [December 7, 2023, 1:30pm UTC](https://community.thunkable.com/t/how-to-make-extract/2742209 "2023-12-07T13:30:28Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![luiz.primaz2ddpyu](https://avatars.discourse-cdn.com/v4/letter/l/e9a140/32.png) [@luiz.primaz2ddpyu](https://community.thunkable.com/u/luiz.primaz2ddpyu)\
**Post date:** [December 7, 2023, 1:30pm UTC](https://community.thunkable.com/t/how-to-make-extract/2742209/1 "2023-12-07T13:30:28Z")

</div>

Good morning, when someone makes a purchase I am saving the data in Firebase: Product, value, code (random numbers) and user information. Now I want to create a screen to display the person’s statement, showing the purchase information but I have no idea how to do it, I don’t even know where to start, I’ll send some information below:

Firebase JSON:

```auto
{
  "compras": {
    "2453094386505": {
      "Codigo": "2453094386505",
      "Produto": "Take me back to the night we met - Chapter 1",
      "UID": {
        "CPF": "000.000.000-90",
        "Cashback": 0,
        "Celular": "51 000000000",
        "Cidade": "EUA",
        "Email": "luiz@admin.br",
        "Estado": "California",
        "Foto": "file:///data/user/0/com.thunkable.live/cache/ImagePicker/91663f37-6f7b-4810-97a4-32e8f4bc8a07.jpeg",
        "Nome": "Luiz",
        "Numero": "2223",
        "Rua": "Christ",
        "Sobrenome": "Eduardo",
        "__scopeVariableInfo": {
          "scope": "APP",
          "variableName": "userid"
        }
      },
      "Valor": 68.99
    }
  },
  "usuarios": {
    "NffX8NEIaLhtYqm4lg9vnpllXHo1": {
      "CPF": "000.000.000-90",
      "Cashback": 0,
      "Celular": "51 000000000",
      "Cidade": "EUA",
      "Email": "luiz@admin.br",
      "Estado": "California",
      "Foto": "file:///data/user/0/com.thunkable.live/cache/ImagePicker/91663f37-6f7b-4810-97a4-32e8f4bc8a07.jpeg",
      "Nome": "Luiz",
      "Numero": "2223",
      "Rua": "Christ",
      "Sobrenome": "Eduardo"
    }
    }
  }

```

I need each time the user makes a purchase to create an item in a list on the statement and for this information to be saved in their registration. Maybe I’m saving the purchase the wrong way, I don’t know… I’ve tried saving purchases in the person’s own UID (usuarios) but I couldn’t.

---

<div class="post-metadata">

**Author:** ![ioannis](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ioannis/32/146956_2.png) [@ioannis](https://community.thunkable.com/u/ioannis)\
**Post date:** [December 9, 2023, 1:40am UTC](https://community.thunkable.com/t/how-to-make-extract/2742209/2 "2023-12-09T01:40:24Z")

</div>

Hello @luiz.primaz2ddpyu  
To present the data from the Firebase Realtime Database you need to use [cloud variables](https://docs.thunkable.com/blocks/blocks/variables#cloud-variables)  
Here is an example:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/7/d/7dce6ed10b470005ce6337cf923688d66d2f60d1.png)

Regarding the issue that you couldn’t update user’s records, maybe you need to adjust the security rules

---

<div class="post-metadata">

**Author:** ![luiz.primaz2ddpyu](https://avatars.discourse-cdn.com/v4/letter/l/e9a140/32.png) [@luiz.primaz2ddpyu](https://community.thunkable.com/u/luiz.primaz2ddpyu)\
**Post date:** [December 9, 2023, 10:55pm UTC](https://community.thunkable.com/t/how-to-make-extract/2742209/3 "2023-12-09T22:55:29Z")

</div>

Hello, thanks for replying, but could you give me the blocks of how I would go about adding the “compras” within “usuarios”. I think the rules are ok, I’m just getting the blocks wrong, I’d be like this:

```auto
{
"usuarios": {
    "NffX8NEIaLhtYqm4lg9vnpllXHo1": {
        "Compras": {
        "Codigo": "222222222",
        "Produto": "Take me back to the night we met - Chapter 1",
        "Valor": 68.99
},
      "CPF": "000.000.000-90",
      "Cashback": 0,
      "Celular": "51 000000000",
      "Cidade": "EUA",
      "Email": "luiz@admin.br",
      "Estado": "California",
      "Foto": "file:///data/user/0/com.thunkable.live/cache/ImagePicker/91663f37-6f7b-4810-97a4-32e8f4bc8a07.jpeg",
      "Nome": "Luiz",
      "Numero": "2223",
      "Rua": "Christ",
      "Sobrenome": "Eduardo"
    }
    }
  }

```

In case you don’t understand, I want to add the “compras” inside the user’s UID (Those random letters).

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [December 9, 2023, 11:22pm UTC](https://community.thunkable.com/t/how-to-make-extract/2742209/4 "2023-12-09T23:22:20Z")

</div>

“Compras” has nested properties. From your screenshot, what is the exact value (not property name) that you want to get?

---

<div class="post-metadata">

**Author:** ![luiz.primaz2ddpyu](https://avatars.discourse-cdn.com/v4/letter/l/e9a140/32.png) [@luiz.primaz2ddpyu](https://community.thunkable.com/u/luiz.primaz2ddpyu)\
**Post date:** [December 10, 2023, 2:43am UTC](https://community.thunkable.com/t/how-to-make-extract/2742209/5 "2023-12-10T02:43:22Z")

</div>

I don’t think I understand your question, but I want it to be executed when a command is executed I want it to store a value with a random code inside the user’s UID, thus saving the information of a purchase. So, later, I want to create a shopping list by pulling the user’s data and taking their purchases to put on a list.

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [December 10, 2023, 7:02am UTC](https://community.thunkable.com/t/how-to-make-extract/2742209/6 "2023-12-10T07:02:14Z")

</div>

Sorry, I got confused between @ioannis explaining how to get values from Firebase and your question about how to save values to Firebase. To save a value, you would do something like this:

set cloud variable usuarios/NffX8NEIaLhtYqm4lg9vnpllXHo1/Compras/Codigo to “222222222” or you can set the whole object at /usuarios/NffX8NEIaLhtYqm4lg9vnpllXHo1 with many different values by creating an object to replace the one that’s there.

You can see an example here: [How to save text inputs to Firebase? - #2 by jared](https://community.thunkable.com/t/how-to-save-text-inputs-to-firebase/2199262/2)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/f/0f59f292712368bce16ff80133ae10de8a6f27e8.png) [@system](https://community.thunkable.com/u/system)\
**Post date:** [March 9, 2024, 7:02am UTC](https://community.thunkable.com/t/how-to-make-extract/2742209/7 "2024-03-09T07:02:38Z")

</div>

Closed on March 9, 2024, 7:02am UTC

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
