Hi,

I have built a view table and want to export it to a CSV file. I had expected that when I push the 'Export' link on the view that it would export a file, however all I get is a page full of code. What do I need to do with it now to make a file?

The cide I see is:

$view = new stdClass();
  $view->name = 'registered_teams';
  $view->description = 'Registered Teams';
  $view->access = array (
  0 => '1',
  1 => '2',
);
  $view->view_args_php = '';
  $view->page = TRUE;
  $view->page_title = 'Registered Teams';
  $view->page_header = '';
  $view->page_header_format = '3';
  $view->page_footer = '';
  $view->page_footer_format = '3';
  $view->page_empty = '';
  $view->page_empty_format = '3';
  $view->page_type = 'table';
  $view->url = 'reg_teams';
  $view->use_pager = TRUE;
  $view->nodes_per_page = '10';
  $view->sort = array (
    array (
      'tablename' => 'node',
      'field' => 'created',
      'sortorder' => 'DESC',
      'options' => 'normal',
    ),
  );
  $view->argument = array (
    array (
      'type' => 'content: field_organisation',
      'argdefault' => '2',
      'title' => 'Argument Test',
      'options' => '',
      'wildcard' => '',
      'wildcard_substitution' => '',
    ),
  );
  $view->field = array (
    array (
      'tablename' => 'node',
      'field' => 'title',
      'label' => 'Year',
      'handler' => 'views_handler_field_nodelink',
      'options' => 'link',
    ),
    array (
      'tablename' => 'node_data_field_organisation',
      'field' => 'field_organisation_value',
      'label' => 'Organisation',
      'handler' => 'content_views_field_handler_ungroup',
      'sortable' => '1',
      'defaultsort' => 'DESC',
      'options' => 'default',
    ),
    array (
      'tablename' => 'node_data_field_team_name',
      'field' => 'field_team_name_value',
      'label' => 'Team Name',
      'handler' => 'content_views_field_handler_ungroup',
      'sortable' => '1',
      'options' => 'default',
    ),
    array (
      'tablename' => 'node_data_field_team_class_1',
      'field' => 'field_team_class_1_value',
      'label' => 'C1',
      'handler' => 'content_views_field_handler_ungroup',
      'sortable' => '1',
      'options' => 'default',
    ),
    array (
      'tablename' => 'node_data_field_team_class_2',
      'field' => 'field_team_class_2_value',
      'label' => 'C2',
      'handler' => 'content_views_field_handler_ungroup',
      'sortable' => '1',
      'options' => 'default',
    ),
    array (
      'tablename' => 'node_data_field_team_class_3',
      'field' => 'field_team_class_3_value',
      'label' => 'C3',
      'handler' => 'content_views_field_handler_ungroup',
      'sortable' => '1',
      'options' => 'default',
    ),
    array (
      'tablename' => 'node',
      'field' => 'created',
      'label' => 'Created',
      'handler' => 'views_handler_field_date_small',
      'sortable' => '1',
    ),
    array (
      'tablename' => 'node',
      'field' => 'changed',
      'label' => 'Updated',
      'handler' => 'views_handler_field_date_small',
      'sortable' => '1',
    ),
  );
  $view->filter = array (
    array (
      'tablename' => 'node',
      'field' => 'type',
      'operator' => 'OR',
      'options' => '',
      'value' => array (
  0 => 'entry_form',
),
    ),
  );
  $view->exposed_filter = array (
  );
  $view->requires = array(node, node_data_field_organisation, node_data_field_team_name, node_data_field_team_class_1, node_data_field_team_class_2, node_data_field_team_class_3);
  $views[$view->name] = $view;

Comments

lurkltd’s picture

So you want a csv file for the table that you created with the view? That export button exports the actual view code, not the result.

drunkencelt’s picture

Hmm.

I'm sure the code is useful for something but not quite what I wanted. Any suggestion how I might manage to convert it to an output?

Cheers

lurkltd’s picture

uhhhh. use a custom theme to print out your results as a CSV?

mndonx’s picture

I'm having this problem as well - all I see is the "export" tab now that I've installed the Views Bonus Pack, but, from what I've read, I should see a CSV and a DOC button just under those tabs. I've enabled the Export View module and checked permissions -- not sure why it isn't working. It's not a matter of the images being missing either.

See this thread:
http://drupal.org/node/114115

And this image for an example of what it should look like (I think:)
http://drupal.org/files/issues/MySite.png

mndonx’s picture

Aha - I replaced the module with the code in post #18 in that thread (http://drupal.org/node/114115) above and it worked! Hope that is helpful.