I am new to Appgyver and this is my first question here.
I am tryind to display specific single record from Airtable. I do not want to display in list component but in single one. I reached to the point where i can use SELECT method but i am not getting the filtering criteria. I have an array of objects and i want to display just a single value in single container. However i cannot think of any validation criteria i can apply here. Any ideas? I have set data resource and data variables, but i cannot figure out if i need a page variable to achive this. Thank you
Hi Vladislav, could you give a more detailed description of your scenario? Do you have many of these records that you want to show on the same page or is it just one per page? How is it determined which one you want to display?
SELECT does work for showing specific records in a list based on the value of a field in your data variable. For example, if I had a data variable that is a list of many fruits with an “id” field, I could use SELECT(data.fruits, item.id == “banana”) to get the banana object. However, if I only wanted to show one fruit per page, a cleaner way to do this would be to create a data variable of the Single data record type by using the id to avoid unnecessarily fetching the whole list of fruits.
Thank you Mari,
Exactly what i am failing is to display single record from array of object without using the repeat and list function. That’s why i am evaluating filtering options. However i cannot get the logic. If i am using SELECT some kind of criteria to iterate through the array I need to use come criteria to match/validate which I am missing. So basically i have a table created in airtable which when fethched through REST API , returns an arrey of object. The problem is that the database is created in Airtable manually and airtable is creating the IDs, so i do not have an ID on appgyver side to match. This example of the REST GET collection response looks like this:
Basiaclly i want to display just the value of key1 on a certain page in a single container without using list. How do i do that? I guess if i get the logic for this one i will be able to do the rest by myself. I just cannor figure out what validation criteria should i use, provided i do not have whatever ID on app side. Probably can get IDs from the API via app or page variable and then match with those IDs, but i am failing to do this as well. Tried to use index, but no success here as well.
I have also used MAP - MAP(data.moTableMain, item.fields[“key1”]) , but with this i am displaying the values of key1 of all objects listed in the array, but i just want to display say the first one only.
Hi, I think I get what you mean. You should be able to display the item with key1 = 4000 in this case with using
FIND(data.moTableMain, item.fields.key1 == 4000). This video explains how to use page parameters to show a single record on a page using the object id.