Sort list with Airtable
Sort list with Airtable
This is a step by step tutorial about adding sorting functionality to your lists using the Airtable API on Bravo Studio.
This tutorial contains screenshots from an old version of data binding in Bravo Studio. The functionalities remain the same as the current interface.
Before you start
Here are some of the things you need to have ready before you begin this.
Figma or Adobe XD
The Bravo Vision app, either from Google Play Store or the iOS app store.
1. Setting up your designs with Bravo Tags
We will have a list of pantry items, where we will show the name, the quantity and the last time it was stocked up, and that is how we will be sorting them.
In *Item [container], the [container] is a Bravo tag that tells Bravo Studio that this is the layer containing the elements that will be used with your Airtable data.
Why the *asterisk? Well, these are the layers that will be populated with data. The only purpose of the asterisk is to allow those layers to stand out when we are binding our data to the designs in Bravo Studio. Alternatively, you can even do DATA-Item Name instead of *Item Name. All we are doing is indicating.
As you can see, we have 3 buttons for our sorting; Item name, quantity, and last stocked. We are sorting our data in ascending and descending order. So that's a total of 6 screens.
Connect each button to the respective screen and test out the prototype to make sure the flow is how you want it to be.
2. Setting up your data
We will have this data with varying names, quantities, dates. That way when we sort it, we can see it in ascending and descending clearly.
3. Working with Airtable and the API
On Airtable, go to your account generate your Airtable API key. You will need this in order to connect your data to Bravo Studio. Find more about it here.
Go to https://airtable.com/api while logged in to your Airtable account and it will show all the tables you have created in your workspace, and chose your table. You will be shown the page below. The Airtable API allows us to use the sort function.
This means creating a GET request link for each of the screens we built out in the design tool. It's not actually that complicated. Thankfully, Airtable added in their easy to use encoder that will create those links for us.
Airtable API URL Encoder
Open up the Encoder site on a different tab and don't close it. It should automatically fill out the Base ID and Table Name. If not, your Base ID is on the Introduction tab of the API page for your table.
Scroll down to the sort section. This is the important part because now you will be creating the link for GET request for each sort function. It's a nifty little tool. Remember how many screens we had? Six screens. That is six GET requests. Enter your field name and it will generate the required link for the sort.
Now is a good time to open up a Google Docs, Note Pad, or Notion page and start copy pasting the links for Ascending and Descending for Item Name, Quantity and Last Stocked. We will need them in Bravo Studio.
4. Connecting Airtable to Bravo Studio
Open up Bravo Studio and click on New Project. Create a new app project with your Figma or Adobe XD file. Once you have done that, click on Data Library. This is where you will connect your Airtable to Bravo Studio. Click on New Collection and name it and hit save.
Make a new GET request using one of your six URLS. Paste the URL, and you will notice I have something in my header. This is where you are authenticating your API requests. So go to the Headers section and set it up as shown below. Field on left will have Authorization and field on the right will have Bearer YOUR_API_KEY.
Hit Send and if all went well, it should successfully show you the sample data, like below. Now check all the fields you want to get your data from that will populate your design elements. Make sure to also check .data.records[]. By default, it will be set to 0, you want to set it to All. That will show all the data from the Airtable on your designs.
Repeat this step for the 5 other URLs.
5. Binding your data to your designs
Now navigate back to your projects and open the design you just imported. It should look something like this. Select any screen to start binding your data to your design.
From the collection dropdown we will select the Data Collection we just made and then it will pull up all the GET requests we created in that collection.
After that, underneath Data Content, you will see a blue link called + Add App Element. Because our elements that will be populated with data is under the *Item element, select that on the popup with the list of visual elements. It will show up under design element.
You will see a dropdown under Bound Data from there select Records[]. Once you do that, a plus sign will appear right underneath it. Click on it and you will be greeted with the same visual element selector popup.
Now, you will select the elements with the asterisks. In our case that is Last Stocked, Quantity, and Item Name.
It should look something like this. Once you have added them, go to the dropdown menu and start binding the appropriate data to your elements.
Repeat the same steps for the 5 other screens.
6. Time to test on Bravo Vision
When you click on each of the buttons, it will display the items in ascending and descending order for Item Name, Quantity, and Last Stocked!
That's it! 🎉
Last updated