App link: Thunkable
In this example, I will be querying a database that receives multiple types of data from various users. This query is based on two qualifiers, both of which are text strings. This process could be applied to any number of items such as name, date, birthday, score, age, SSN, flavor, favorite thing, shoe size, etc. In my case, the qualifiers are ‘user’ and ‘data recording format.’ The data are fed into a graph for both myself and the user to see. I use the same process in another app to only see user data/graphs and edit the DB. The “admin app.” I will post another when I figure out how to filter based on date. This date filtering process should be similar. This tutorial should also be attributed to @actech for the help he provided in the process!
When the app opens, five variables are initialized. One variable is for the raw data. The other four are for the specific lists of values that I want to grab and display based on some qualifiers.
Each time this screen is opened, all rows (the entire table) are grabbed from the AirtableDB and stored in the variable "raw data.” If there is an error, it will be displayed in ‘label 3’ on the same screen.
When ‘button 2’ is pushed, the following occurs in order:
All 4 “_templists’ are set to be ‘empty lists’ in case there is old data in them. These will be used for any variety of things. in my case it was to be used as paired coordinates to display data visually in a line graph
Then the app creates a list variable ‘j.’ all of ‘raw data’ goes into ‘j,’ allowing for each row to be looked at as an individual object.
then the query occurs
Something helpful to think about is that in this process, a ‘property’ is synonymous with the name of a column in a database. Something to notice is this process is filtering all data not only for one qualifier but 2. my app doesn’t utilize all columns of data for every data entry that the user completes. You could avoid this by using multiple tables, but I didn’t want to do that.
First, the app takes out any ‘rows’ or objects in which the cell corresponding with the property ‘name’ doesn’t = jared.gibb@gmail.com. if it does, that object is passed on to the next filter
The app takes out any object or ‘row’ in which the cell corresponding with the ‘column’ or property ‘count 1’ is empty. If that object’s ‘count 1’ property is not vacant, that object is passed on to the next set of blocks. For my purposes, if count 1 was empty, then some other data recording format was used, and therefore, that row should not be used. If row 1 had a value, there is no way for another format to have been used, and therefore, I want that row.
At last! I have only the rows that are relevant, based on my two qualifiers 1: name and 2: ‘not an empty cell.’ each of the 4 ‘in list’ blocks pulls out a specific property from the current object and saves it to its own variable.
because this app was for learning and experimenting purposes, the data are only then sent into labels to verify that you are receiving the correct filtered data from your database.
the screen i use
the blocks i use
this is how it is utilized in my bigger app.
and this is what the Airtable looks like