[support] Writing header to csv file with bulk operations

Steve Edwards killshot91 at gmail.com
Sun Oct 31 05:50:43 UTC 2010


I have a case where I need to flag a certain list of nodes and export data from them to a CSV file so it can be imported into another application.  My plan has been to use Views Bulk Operations with a custom action.  I had looked that VBO export to CSV functionality, but the problem is that it only exports the fields that have been added to the view, and I only want to add the items to the view that help the user select the appropriate items.  In addition, there is a large number of items in each node, and so once I need to identify the items and then go get the data.

The problem I'm having is that the action is run through once for each node, but I need to create the file somewhere and add the header before I start writing node data to the file.  Is there a way that I can call this function before I start writing the node data to it without writing the header out for each line?  I'm sure there's a semi-obvious solution, but late on Saturday night, my brain's not coming up with one.

Thanks.

Steve


More information about the support mailing list