Exported CSV is empty when a filter is applied.

Created on 27 March 2019, over 5 years ago
Updated 10 November 2023, about 1 year ago

When I apply a filter to a view on the frontend and export a CSV from it, the file is empty. However on the view preview the results are appearing correctly.
For instance the following path results on a en empty CSV, but if I edit the view and set that filter value, the results are right on the view preview.
http://my.site.com/admin/content/export?some_field=176&_format=csv

πŸ› Bug report
Status

Active

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡¦πŸ‡ΊAustralia nickgeorgiou

    I know this is old, but it's still appearing for me. I fixed the issue by changing the exposed filter widget (Selection type) from Autocomplete to Dropdown. This fixed the issue and the correct data was exporting for me as CSV and JSON. I tested this issue / solution for both CSV and JSON.

  • πŸ‡¨πŸ‡¦Canada francewhoa Sept-Îles, QuΓ©bec, πŸ‡¨πŸ‡¦

    We were able to reproduce this challenge using those steps

    Steps:

    1. Add an Autocomplete filter to your View.

    2. Using the View above, using the Autocomplete filter, search for keywords which includes those two bracket symbols [ and ]. For example, search for this [Keyword]

    3. Click on "Filter" button to display the result

    4. Results are all displayed

    5. Using views_data_export module, export to a CSV file

    6. Open the CSV file you created above

    7. The first line is included in the results. This is the header. But all the data is not included. In other words, the table header is included, but starting on line 2, all data is missing. This is the challenge. The needed end result is that all data is included in the CSV file. Not just the header.

    8. Redo all the steps above, except, remove the two bracket symbols from the filter. Now all data is included in the CSV file. So somehow, the two bracket symbols are related to this challenge.

    Using views_data_export 7.x-3.2 or more recent stable version

  • πŸ‡¬πŸ‡§United Kingdom drupalninja

    You can disable the access checks under the options Query Options in the view and that should allow you to download all results.

  • πŸ‡¨πŸ‡¦Canada francewhoa Sept-Îles, QuΓ©bec, πŸ‡¨πŸ‡¦

    Thanks drupalninja :) We'll try this access checks

  • πŸ‡¬πŸ‡§United Kingdom steven jones

    @drupalninja / @francewhoa I feel like disabling access checks should be the wrong way to go. They are usually there for a good reason!

    I'd be interested to know if you're able to share the configuration of your view and some of the setup of your site so we could reproduce this issue and get a test into the module. This is certainly something that should be working already and indeed I have some views with various filters and the exports work fine too, so I'm curious to see what's different here.

    If there are access issues, then it might be something unique to your environment, like the path for the export view being something ending in a .csv and then something infront of your webserving removing cookies from the request so that a logged in user appears to be logged out when the request get to Drupal, hence why removing the access checks would work for your use-cases.

Production build 0.71.5 2024