Hi, apologies if this is a simple task but I can’t seem to find the solution or get my head around it.
I am trying to display rows from a Google Sheet based on the logged in user and the email address they used to sign up/sign in, i.e. only show rows that they are allowed to see.
In my Google Sheets I would have the email address on one or more rows for the logged in user.
I have used the sign in example thunkable project as a starting point for my sign in and then when the user logins I have managed to get data from my Google Sheets which currently displays all rows as per:
The bit I am stuck on is how to restrict the rows it displays based on the logged in user.
Any help would be much appreciated or point me in the right direction.
It’s a lot to ask us to watch a 15 minute video and try to figure out which part you’re referring to.
I would suggest using Firebase for this, if you can. Firebase is intentionally designed to allow users access (via rules) to only their own data.
If you can’t or prefer not to use Firebase, then you would store the user’s ID in a column and each time you want to access only their columns, loop through the ID column and save the rows that match the user’s ID to a variable. Then use that variable (list of rows) throughout the rest of your code.
I will need this too so reading this post I went ahead a bit and tried to solve it.
Unfortunately, unsuccessfully
For the Shift_List var I have used sum of list as in this photo and also just list.
Don’t know if sum of list combines the lists elements into a bigger list or literately sums the numeric values in that list so I have tried both.
At the end you can see I have tried both list viewer and data list viewer.
Those blocks will attempt to sum a list that contains a list and an object. I don’t think you’re going to get viable results with that.
As an example, let’s say Shifts_List contains {2, 3, 7} and Shift contains … well, an object. The sum of a list with those two items is going to be {2, 3, 7} + [object]. I’m not even sure what that means. {2, 3, 7} is a list, not a numeric value, so it can’t be added to something else. And an object isn’t a numeric value either.
The sum of list block should really be used with a single list. And that single list should contain numeric values for its items. For example, the sum of {2, 3, 7} would be 12 (because 2 + 3 + 7 = 12).
You could use a + math block to add the sum of one list to the sum of another list. But you still can’t do that with an object!
Hi, thank you for looking
This is basically what I have so far https://x.thunkable.com/copy/810b989b1cf9970042944c8139fbd980
Currently when the user logs in they see all rows from the Google Sheet.
What I am trying to achieve is that when the user logs in, they will only see the rows in the data list that they are allowed to see. Currently I have set the same email address against each row in the spreadsheet (for say 2 or 3 rows). So if they log in using the same email address, it will only show those rows.
Maybe that is not the right way to do this? You mentioned Firebase but I am not very familiar with this yet sorry.
Thanks
Apologies, even that is a bit beyond me at the moment. I’m very much at the pre-school learning stage of this system and bumbling my way through.
Do you happen to have an example of what you are talking about please? Or point me in the right direction?
Thanks