update: i tried to set the variable to the list from the google sheet, along with “unnamed columns” 19-21, but they all show up as “undefined”, even though there’s actual data occupying each column in the sheet
Initializing a variable with a list of values from a data source will cause issues.
The best practice there is to initialize the variable to an empty list and then set it to the list of values when and only when you need to access the data.
anything that could be wrong with the list?
Hi @wulfy_starr ,
I don’t think that this issue is solved. I have this problem with slow “get value from…” blocks for years now. In theory the combination of a data source and one or more Data Viewer Lists is an elegant and powerful combination:
- just add (for example) an “airtable” as a data source
- add a DVL, connect it with the data source
- and when clicking on your DVL (or swiping!) you get an ID and can get the relevant information with the “get value from…” block, which has the ID as its input.
I measured the time the “get value block…” takes and this is very disappointing. Look at the following program structure:
With row_ID you can get every kind of information from the data source.
However, the time required to execute the “get value from…” block varies: If you click an entry in the DVL for the first time, it takes significantly longer. If you click on an entry for the second time (and all subsequent times), the execution is much faster. Here are some measured examples:
Time for executing the “get value from…” block:
- Thunkable “preview”:
– 1st click: 0.76 … 0.9 seconds
– all subsequent clicks: 0.075 … 0.08 seconds. - Preview on iPhone 8:
– 1st click: 0.8 … 1.0 seconds
– all subsequent clicks: 0.4 … 0.5 seconds
You may say “0.9 seconds is not much for a simple listing”. But in my app I have a list of ~20 restaurants and to display all locations on a map I need 20 * ~0.9 seconds!
My solution?
- I migrated all data from airtable to google firebase
- when the app starts I read all data from firebase with one cloud variable and then fill a local datasource with the values. Here the “get value from…” block runs really fast with the local database. Don’t forget to the the local datasource to “App data source” and not to “Stored data source”!
- on startup I have to create lists with the record IDs, when there are connected fields in airtable.
- that way I can connect the DVL with the local database.
I hope that helps and hopefully someone from thunkable support can have a look at this problem.
this does seem like a good method and i will try it in the future, however this is not my current problem. :[
my problem is that i’m having trouble trying to get values in a list from a specific column. the app acts like the column does not exist for some reason…
It seems you have a lot of data to sort though (days, moods, count, and class). It would help us to show your google sheet(s). I recommended before that you try using formulas in google to sort through your data using another sheet and use that new sheet to load your graph. I don’t know if you’ve tried this but it’s worth looking into. If you don’t know how to do formulas in sheets you can always ask Chat GPT for assistance explaining what you want to accomplish.
Check it out:
The first sheet is your imported data from the app and the second sheet is the filter.
i have already done somewhat what you described using a pivot table (this is a copy of the sheet i mainly use)
in the “Student Stats” sheet is what i’m currently working on
The pivot table might be your problem but I cannot confirm that. What is the end result you’re looking for? To display only the very bads, or very goods, etc?
Would this be easier to work with? I modified a copy of your sheet if you want it. This new sheet is called students stats 2.
More Variables can be added to the formula, i.e. date, teacher, etc.
to summarize, i am using a stacked bar graph from quickchart. on a screen where the graph will be displayed, i am trying to make it to where the graph returns all of the data the student has put into a main google sheet for the whole week. there will be a lot of students using this app, so every single datapoint from each student will just be compiled into that sheet (which is what the “All Data” sheet is for). ideally, the graph will pull data from an organized pivot table, so there will be less rows for the app to read through. the app will read through the pivot table to search for the ID of the student that’s currently logged in, and display the data from that specific row into the graph.
Who is this app designed for, the teachers or the students? I ask this because I need to know how many users will be accessing this data at the same time.
both teachers and students. this app will be made for my school, so there may be over 1000 users, give or take
Ok, now is see. I was playing around with your table for a little bit and now I understand that you want every student to have their own row. You might need to create another sheet that just grabs the data from the pivot table and label all the columns.
Like this maybe.
This is a lot of coding on your end I bet. In hindsight you could’ve stored each student ID in one column and second column containing a JSON of the students data. Then all you would have to do is grab one cell and edit or retrieve data in it. Good Luck!
it seems like a lot, but i’m not really overwhelmed by it! it’s a new learning experience for me and it gives me ideas on how to optimize the code later :]
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.