Create CSV file for selected records

I want the user to be able to select multiple records and then have a csv file emailed with details of the selected records.  I know how to create the template and how to make/use a trigger column, but if five records are selected, I only want one file sent to the user.  I've tried a zillion options, but none seem to work well.  

What's the best way to do this?  I already know about trigger columns and about templates, but I can't seem to figure out how to put these things together in a way that works.  One way I played with would be to put a datetime value in the trigger column and then have an action that sends the email with records with similar datetime values, but I don't understand how, in a csv template, I can make a select statement that will select all records with a datetime that is greater than now minus five minutes.  

Another approach would be to have a separate table with a column that is a list of related records, but with that approach, I'm not sure how to select the records found in the list and how I'd reference the related fields if I did. 

0 4 714
4 REPLIES 4


@RedVox wrote:

Another approach would be to have a separate table with a column that is a list of related records, but with that approach, I'm not sure how to select the records found in the list and how I'd reference the related fields if I did.


Something like this is likely the right approach. Add a Yes/No column to the existing table to reflect whether each row is selected. Then allow the user to invoke the action from outside the context of any specific row from the table. If helpful, the automation can clear the user's selections after generating the file.

ICYMI, it's also possible to Export this view to a CSV file - AppSheet Help. If helpful, use the user's selections to filter a view to just the desired rows and then send that to csv directly without any automation necessary.

So, for the separate table approach, I will have a field with a list of member ref_rows.  In the csv template, how can I make a start: select() statement that will use the list of ref_rows as the filter?

Regarding the export this view approach, I suppose I could save a change in the selected rows, go to a new view filtered on those rows then initiate the csv. Hmmm.

Actually, going to the selected view only works from an individual record, so I'm back to creating a list in a separate table then using the list to select records in the template.  Hoping you can help with the select statement.  Thanks!

Out of the box, AppSheet enables you to download what you see in a CSV file. So you can use the search/filter bar on the top to show only the desired records and download them in a CSV file. The user then would separately email the file.

If you want to use your method of selecting records created within the past 5 minutes then you can use this expression:

FILTER(tableName, NOW() - [timeStamp] <= "000:05:00")

 

Top Labels in this Space