Forum OpenACS Q&A: Outputting results of a query to a CSV

Request notifications

Collapse
Posted by Brian Fenton on
Hi,
I need to create a CSV file from the results of a query. I searched in the api-doc for csv and found a proc called template::list::write_csv which sounds like just what I need. I've grepped through the code for examples of how to use this proc but my search turned up nothing. The proc seems to expect the name of a list passed inĀ  - I don't really understand what this list might be. Can anybody point me to an example of how to use this proc?

many thanks
Brian

Collapse
Posted by Joel Aufrecht on
Using the tutorial as a starting point: If you put the command template::list::write_csv -name notes at the bottom of note-list.tcl, then when you browse to note-list, you will get a csv instead of a formatted html page.
Collapse
Posted by Jade Rubick on
You can search my postings for a query on how to return the CSV to Excel. I've actually not gotten this to work myself, but I may have to do this in the next week or two, so I'll probably give it another stab.
Collapse
Posted by Brian Fenton on
Thanks for the replies guys. I'll give it a whirl.