You can have a separate record containing the desired data (filled in by script before the export). Using a 'sort-key' field and a sort-command will place that record as first record before export.
The export script has to make sure that this record is present (if not, the script can create it again)
You can also have a separate 'virtual' table, records to be exported have to be imported first into that table - with a 'header record' as the first record
So the issue here is this: In our inventory database we track exactly what items we have in stock. Ie. if we have 10 Item A's and 5 Item B's, than the inventory table would have 15 records. When we go to export, the export file only has 2 records:
Item A 10
Item B 5
The report that I've been developing has a lot of summary fields that I'm not sure how to dump into an export table without writing a MONSTER script with several layers of loop routines. I'm dreading that solution.
When exporting data, there's a "group by" option that allows you to export what is effectively just the summary layout part rows of a summary report--one row for each sorted group of records.
Yes! And this is my ideal scenario, but the headers that are exported in this scenario won't work. One of the fields that we're exporting "TotalCountSum" gets changed to "TotalCountSum by Section" when I group the export by section. The exchanges that we're uploading this inventory to want this column to be labeled "Qty".
I'm happy to change the field names so that the headers export properly, but when I use the Group By feature the heading names are uncontrollable.
But the same basic method can be used to generate records in an export table and then you only need add a "header" record to make up that initial row of your csv file.
Very fair point. I'll go down that road and see where it leads me. Thank you for the suggestion!
I've gone down that road and seem to be facing an export obstacle.
I've created a table called "Export" that my Inventory table dumps into My script inserts the header rows at the top of that table: so far so good. The Export table has a field called "Quantity" which is intended to display (and export) a count of the total number of records when sorted by the field "Row". This is where things fall apart.
In order for the field Quantity to calculate properly, Quantity needs to be a Summary field, which precludes me from adding the field header in the first record. And if I allow the export process to use the field name as the column header, the Quantity header gets exported as "Quantity by Row".
Any new ideas? As always, any and all input is greatly appreciated!
Isn't Quantity a different total for each summary group of records? If so, the function GetSummary can use a summary field and a "break" field to compute that sub total to set the value in the field for a single record.
And one rather odd approach to this method is to export the "grouped" data to a text file, then import it back into a FileMaker table in order to combine it with your special header record.