Filtered workflow CSV export

Hi. I have an app that has some test information captured in a table. It is a child of another table based on days that the test machines worked. I’d like to export using a workflow save data to CSV template method from the test table. I’d like to do this by selecting the day to export and have only the tests associated with that day exported.

I’m pretty sure that I need to have some sort of filter in the CSV template instead of the standard select statement from the documentation on this method. I just can’t work out what it should be. Does anyone have any experience with something similar or can offer some suggestions please?

I’ve been planning on triggering it via an action button in the day.

1 Like

In the template you can use a <<Start:>>/<<End>> based on any SELECT() or FILTER() statement.

For example, if your child test data was kept in a table named “Tests”, you could do this

<<Start:  FILTER("Tests", [Test Date] = [_THISROW].[Selected Date] ) >>

(template based on Tests table columns,  <<[ColumnA]>>, <<[ColumnB]>>, etc)


Of course, I’m assuming that the row that triggers the Workflow and is sent to the template will have your selected date included in it so you can filter the Tests table by it.

Also, I’m not completely certain if the [_THISROW] part is needed. You can try with and without it.

I hope this helps!!

1 Like

“Needed” or not, it should be used to avoid ambiguity.

1 Like

Hi, thank you for your replies. It is not really a date related thing, but I have used the method suggested to try and solve this.

I haven’t quite solved it, but I am getting data through. I’ll try to give some more context here to help. I have setup the workflow to be triggered when there is a change to a row in the parent table (called “RigDays”). This is working and I’m getting the correct parent row selected and the export is returning the first applicable row in the tests table (called “Tests”), but not any of the other rows that are applicable.

The parent table has a virtual column called Related Tests that I’ve not had that much success with

I have had some success using the Unique ID from the RigDays table, RigDayID, which is also next to each record in the Tests table, column RigDay.

Here is the code that is the CSV template:

<<Start: SELECT( Tests[TestRecordID], ([RigDay] = [_THISROW].[RigDayID]) ) >>

"<<RigDay>>","<<JobID>>","<<TestType>>","<<TestName>>","<<Date>>"  etc...


I’ve also been trying FILTER( “Tests”, ([RigDay] = [_THISROW].[RigDayID]) ) ,but this is effectively the same as the SELECT statement.

Any help would be greatly appreciated.

Here are some snapshots of the tables:


Exported CSV

So, I have played with the CSV file creation a bit. I have created many CSV’s in my day but have never done so through AppSheet.

There are some differences you need to apply from the articles.

This is the result of efforts:

Instead of SELECT() like you need, I made use of an existing child list for my testing. So the template I used looks like this:

Product Description, Serial Number, Quantity, Price, Total Price, Comments <<Start:[Related Products]>>
<<[Product Code].[Product Description]>>, <<[Serial #]>>, <<[Quantity]>>, <<[Price]>>, <<[Total Price]>>, <<[Comments]>><<End>>

Note these 4 things:

  1. The header info is outside/before the Start
  2. I removed ALL of the quotes
  3. To prevent insertion of blank links, I had to string everything together - no returns while editing.
  4. Columns need to have square brackets for them to be properly pre-processed.

OH, and one last note - make sure none of the data fields contain commas!! This is true for any CSV file creation but worth noting.