[Solved] Retrieve data from Airtable based on condition

Hi All

I have a simple app that allows users to data to airtable - it also uses google fire base to provide sign in authentication from them.

They can then view that data submitted

However I would like to be able to pull back only specific rows of data from airtable based on the users login,

Does anyone know a way o could achieve this alternatively each time they submit I could add an identifier but I’m not sure how I’d do this,

Any suggestions?

1 Like

Hi Jacob111,

There is a login (unique) and password from the user. The easiest way is to filter the data: load all the rows from AirTable to list and then in a cycle to select data from list that matches the login field. Why do you need an identifier if there is a unique login?

What specifically causes difficulties for you?

Hi actech,

Thank you! The reason I need a unique identifier is because several people with one unique identifier will see certain information, while other people without that identifier won’t, I need to be able to seperate this data across people dynamically,

Does this make sense?

Thanks again
Jacob

So can make one public login like “user”?

And is it suitable for you when you use public free admission? If user registered and have a login - we show one, and for unregistered users - another.

When the user successfully enters via Sign In, the block returns userId. It can be used in AirTable.

1

Thanks actech, but the unique identifier can’t be different for all,

For example I have 7 people from one company, they should only see what is submitted in Airtable by people in that company,

So I’d like to make it dynamic in airtable, I still don’t quite get how userid could help in this situation?

Thanks
Jacob

Now I understand. Then you need to supplement the entry with a unique company ID. In our country it is an INN (a unique identifier of the taxpayer). When a user registers he enters INN and the program checks whether there is a company with such a INN or not.

Authorization of the company is a complicated process. Everything depends on the level of information secrecy. These are already issues of data security. Someone from 7 users can give their friend a login and password.

I think it’s more practical for you to issue a company ID. Then the user will enter not his login, but the login of the company.

What about creating an extra table “user_company” with columns user and company. Then get company from the user on login.

Jacob,
I also need to retrieve a specific record (all columns) from my Airtable; I can use a key (email example) but between Spreadsheet GET component the only filter is the ROW.
How I can know the row of a specific record?

I read actech answares but I do not understand how to do it.
Many thanks
Andrea

… same problem if I have to update a single field of a single record … I have to point the record with a key and then update the field.

How I do that?
Many thanks
Andrea

Hi Guido/Andrea,

It sounds as though you have similar problems. I wasn’t able to pull back on individual emails - but I could do it with one username and one password per company using google firebase and the “sign-in” component - please let me know if this suits your needs and I can assist

Thanks
Jacob

Hi,

What is specific about your complexity?

You can filter entries from AirTable by any number of any fields. Also each record initially has a unique identifier in addition to which you can create your own fields with unique values.

To solve such problems, you first need to create a general scheme MVC (Model-View-Controller) on paper. Then it becomes clear what data and where to use, how to show them and how to link the data in the table with their display in the application.

Ciao actech,
no problem to select a single record pointing the row number … but how do I know what the number of records is?

for example … I have a address table with email in key … I need to get just one record that have a specific field data so …
Maybe you say to parse all record filtering? could you show me a block ?

Thanks thanks
Andrea

Hi,

First of all you need to get all records from a table in a list with a block of “getAllRows”. After that, local storage will contain all data from the table and they can work on any screen. List filterList stored filtered on two fields a “email” field and Age. This list is assigned to the ListViewer and it displays only the values for the field Name (values of _id non visible). Selecting from the list with the value of the Name field is also a unique key of _id entry in which the entry can always be found.

Working with the list of records is less effective than database queries. But the algorithm shown is universal and requires only one query to the database to retrieve data. After that you can do with the data whatever you want.

8 Likes

By clicking what, you got “join” in if else statement of your png

You can get the “Join” block from “Text” Blocks as below

image

Screenshot_2018-09-12-14-24-10-568
Ok ?
Now I will remove 2 string ones
This is what I get


Now I will go to settings of join and remove 2 items


Finally what I have got is only this Screenshot_2018-09-12-14-25-55-280
Can you please tell where am I missing ?
What I want is this ! join

You must keep one “item” block in the “join” block so only remove one and you will get the required block.

2 Likes

Ok got it thankyou

hi actech,

i have few questions regarding your solution:

in your solution you copied the rows from the DB to the list “filterList” in the local memory of the app. how do you initialized that local list? how to determine the number and the type of the columns?
what if i manage my DB in airtable and i store pictures there, can this script copy those pictures to the local table?

as i understand, instead of insert hardcoded email address, with the sign in we can store the email of the user in global variable and use that variable in order to retrieve the relevant data?

thank you