AnsweredAssumed Answered

Exporting records as .csv in iOS

Question asked by StevenReynolds on Jan 10, 2013
Latest reply on Jan 10, 2013 by StevenReynolds

Title

Exporting records as .csv in iOS

Post

I'm managing a Filemaker Pro 12 solution to create purchase orders and send them via email for the iPad but the iOS Platform doesn't allow to export Excel files.

     Currently we are sending the orders as a .pdf file but the warehouse has to manually approve each order. The solution we were thinking of is to send a .csv file attached to an email so that the warehouse has less work.

     I'm using 3 different tables to create a order. A table that stores the products, a container table (to set the quantity, discount etc.) and a table for the order itself. So you can for example create three product-A and two Product-B in an order which works fine. My PDF solution uses an extra Layout and works fine. On a PC or Mac you can export Excel files with a script and the "Save Records as Excel" function, but this is not available on iOS, so I'm looking for alternatives.

     The script I came up with to send the .csv file via email looks like this:

Set Error Capture [On]
Freeze Window
Go to Related Record [Show only related records; From table "Orders_Container"; Using Layout: "MailLayout" (Orders_Container); New Window]
If( Get (LastError) = 0)
    Sort Records[ Restore; No dialog]
    Set Variable[ $FILE; Value:Get (TemporaryPath ) & "file.csv" ]
    Export Records [No dialog; "$FILE"; Windows(ANSI)]
    Send Mail[Send via E-mail Client; To: "customer@web.com"; Subject: "Order"; "$FILE"]
End If
Close Windows [Current Window]

     I tried to use the function "Export Records" but it exports all records of the current customer instead of the 'Records being browsed' which is only available for the PDF export. I've tried to do this but on iOS you can't create a new file to export and I can't come up with something else. I don't want the users to use Menu -> Export -> E-Mail because they will have to enter 3-4 Email addresses each time which is way to time consuming (this also exports all records instead of the ones which are currently being browsed). Is there any way to export the records that are currently open, save those in a .csv file and send a mail with the file attached?

     I've already posted this question here. Also thanks in advance!

Outcomes