Hi all, I am currently creating a project whereby I would need the label value to be updated each time a new data is keyed in. Hence, may I ask how am I able to get a value from a specific value from a row, by using one single get value block?
Are you wanting the value of a label to change when the data in an external data source changes? If so, you’ll need to use Firebase for this.
Do you have a sample to refer to?
It’s a single block (see the link I posted) so I don’t really have an example. If you need help setting up Firebase for use with Thunkable, just Google Firebase Thunkable to get started with documentation and videos.
If you get stuck, explain what you’ve tried and post a screenshot of your blocks and someone can help you.
So long as you are not allowing users to filter what the label displays, and you have standardised it to show the most recent entry for example, you can use the followng workflow without the row ID:
Simple
Local Storage Only
- User enters the data on a different screen
- The data you want the label to show is stored in a stored variable
- The label’s text value is always set to the stored variable’s value whenever the screen opens
This way it will always show and update, even between sessions.
External Storage
- Someone enters the data on a different device
- The data is then sent to the database
-----Table Based Database (Airtable for Example)
3) The user opens the app and it checks for the last entry in the table and stores that in an app variable
4) The label’s text value is always set to the stored variable’s value whenever the screen opens
-----Non-Relational Database (Firebase for Example)
3) The user opens the app and it gets the value for a key (could be “entry-last” for example) and stores that in an app variable
4) The label’s text value is always set to the stored variable’s value whenever the screen opens
Upon deleting or changing data, so long as the data is not the most recent one, no update is required.
If you want something more dynamic like allowing filters for the what exactly is shown or showing multiple data values on the label then you would need to create a model that saves the rowID for what you want to be shown if you decide to use a table:
A Bit More Complex
External Storage Only
-----Non-Relational Database (Firebase for Example)
Same as before, just store tha data in specific keys that get updated each time an entry is made, and then that value is gotten and stored upon opening the app or screen. This is my preferred method
-----Table Based Database (Airtable for Example)
Unfortunately this is always a hassle as Thunkable asks for the row number to get the value from a specific cell, and Airtable does not provide this data. You could try the following flow:
- When someone opens the data entry screen, all rows from airtable are fetched, and you have a for loop that adds +1 to a count variable (initialised as 0, this could also be a simple hidden or visible label)
- When the person enters the data the count variable is incremented by 1, then this row number is saved on a cloud variable (again, set specific keys to differentiate what is being viewed and by who). This way, you can get the data. You could also just store the data in the cloud variable keys and forgo the data fetch from the table.
Those are just suggestions based on my understanding, if they are not in-line with your goal(s), then I agree with @tatiang that we need more context such as how and where you’re storing data, if you want the data the label shows to be different based on who is signed in, and so on.
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.