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 4 1,596
4 REPLIES 4

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)

<<End>>

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!!

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

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...

<<End>>

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:
RigDays
2X_1_15cd591ee97b7e6ab998911c5ff14f90090a4001.png

Tests

Exported CSV
2X_5_5bd498d9262214ba6cf39e8e7c7d17b981fe5798.png

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:
2X_e_efe341b2b44aa1e05a4447ef5885a05b59ffef81.png

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.

Top Labels in this Space