Adalo Custom Component - CSV Export

Photo by Goran Ivos on Unsplash

Adalo Custom Component - CSV Export

I built Adalo Custom Component for living on Adalomatic; starting today, I will share some of the new components that I created and share how to use these components.

The Issues

Currently, there is no way for users to download the database collection as a CSV file. However, one of my clients requested to download the data key-in by the app user.

The Challenge

There are no easy ways to pull the relation for each database collection. Creating a single collection CSV file to download is relatively straightforward; if needed to download with relation data will be challenging.

The Solution

I built the CSV Export component that supports downloading CSV files from a single database collection and five related collections.

For single collection, CSV download is simple.

csv-export-setting.png

  • The main setting includes the filename for the CSV file, which collection to use and toggle for multiple collections; let's talk about the multiple collection section later
  • Button includes how you style the button and what text appears on the button; by default clicking on the button will trigger the CSV download process already, but you can still add some action here, for example, update the current user record etc.
  • Header is for the first row of your CSV file; you want to have a column header for each column.
  • Collection value will be what value to display for each cell; if you have set the collection on the first part, you should be able to apply any value from the collection.

Setup the single collection download process first to make sure everything works, then let's go for merging multiple collections into one single CSV file.

csv-export-setting2.png To set up multiple collections CSV download, turn on the "Enable Multiple Collection" toggle first. You will see lots of setting show after the option is enabled.

  • Number of Fields from Collection - what this means is, for this particular database collection, how many fields ( columns ) if required? If you need two fields (name and age ), update to 2.
  • Collection - You need to select another related database collection, and set up the filter for the collection, for example, all records belonging to the login user.
  • Header - still the same function that you can name the row header.
  • Collection Value - this is related to the collection that you set up; for example, for collection 2, you have updated the number of fields to 2, then you need to set up 2 Collection 2 Value only will do.

Once every collection number of fields and the collection value for each collection have been set up, the download process should work fine.