Forum OpenACS Development: Re: Creating a .CSV file with OpenACS

Collapse
Posted by Brian Fenton on
Hi Juan

well, it sounds like you want both the list displayed on screen, and the CSV file downloaded, is that right? You could have a form where the user chooses the format they want (list or CSV). Then in your list do something like this:

set selected_format "normal"
if {$parameter_csv == 1} {
  set selected_format "csv"
  set groupby ""  
} 

(Setting groupby to empty string fixed some problems for me, you might not need it).

Then in your list itself, do something like this

template::list::create \
  -name $list_name \
  -multirow tickets \
  -numeric_type "Integer" \
  -caption "[_ aims-client.FinSummaryListCaption]" \
  -no_data "[_ aims-client.FinSummaryNoneAvailable]" \
  -elements $elements_list \
  -pass_properties {locale } \
  -selected_format $selected_format \
  -formats {
              csv { output csv }
            } \
  -orderby $orderby_list \
  -groupby $groupby_list \
  -filters $filter
Finally after you've created your list and multitrow, you just need to call this:
if {$parameter_csv == 1} {
  template::list::write_output -name $list_name
}
Collapse
Posted by Juan Carlos on
Thanks. It worked.