Export nested data

Hi,

I have a database structure which has ‘Patient’ as head type and a ‘Patient’ has 8 other datatypes. Al these 8 datatypes have 20+ attributes. I want to export Patient data to CSV. I could export all 8 data types and copy the 8 CSV’s back together, but that isn’t user-friendly.

Has somebody experience with this?

My current option is to use the RG to csv plugin, but then I should put all my attributes in a row of a RG (I have +150 attributes in total per patient)

Thanks in advance!

2 Likes

I came across this case recently and also first tried to use the RG to CSV plugin, but it wasn’t ideal.

The solution I came up with will take a bit of work to implement but it’s quick to download and easy to understand:
-Create a new Data object called “[Thing] Download” and create all of the fields you’d like to download. I believe the download will create a spreadsheet in alphabetical order by the name of the field, so if you care about the order, you may want to name the first column something like “aa Name” or something like that.
-Whenever the highest level object your download is based on is created, also create this object, and fill it in with the relevant fields. (And modify it whenever the object is edited.)
-When all of the other items related to this object are created (or edited), modify this object to fill in the fields you now have information about.
-To make sure you capture all of the data you currently have in the database, you should make an API workflow that creates and fills in this new object.
-Finally, use the download as CSV workflow option on this new object in whatever workflow you’d like to download the data.

Hope this helps!


Kevin
AirDev

We’re looking for Bubble developers to join our team: https://jobs.airdev.co/

3 Likes