Problem/Motivation

After upgrading Drupal to 10.2, exporting CSV in batch mode results in an empty file (0 bytes). Switching the export to standard mode fixes the problem. [Update: Deleting a particular exposed filter also fixes the problem.]

Steps to reproduce

[Update: See the comments below for the configuration of the exposed filter that appears to cause the problem.]

In Drupal 10.1, create a View with a CSV export in batch mode. Verify that it exports the data correctly. [Update: add an exposed filter as specified below and note that it still exports correctly.] Upgrade to Drupal 10.2 and note that the resulting file contains no data. Change the export to standard mode and verify that you can export the data. [Update: delete the exposed filter and verify that batch mode now works as well.]

Proposed resolution

unknown.

Comments

BenStallings created an issue. See original summary.

BenStallings’s picture

Status: Active » Postponed (maintainer needs more info)

on further investigation, some of my Views still work in batch mode, so I'll have to do some more sleuthing to find out what's wrong with the ones that don't.

BenStallings’s picture

Status: Postponed (maintainer needs more info) » Closed (works as designed)

The problem turned out to be one of my exposed filters. I can't explain why - it's a plain old text field, and an exposed filter on another text field works just fine - but for some reason exposing that filter is incompatible with batch export in Drupal 10.2 even though it worked just fine in 10.1. I can either expose that filter, or I can have batch exports. Leaving this ticket here in case someone else has the same problem.

BenStallings’s picture

Status: Closed (works as designed) » Active

I'm changing this back to Active because the problem does seem to be in this module, and maybe if I provide enough info, someone could reproduce it. Here is a diff of the broken vs. working View, showing that all I added was an exposed filter.

--- a/config/sync/views.view.donations.yml
+++ b/config/sync/views.view.donations.yml
@@ -2057,6 +2057,51 @@ display:
           hierarchy_depth: 0
           required_depth: 0
           none_label: '- Please select -'
+        field_donation_code_value:
+          id: field_donation_code_value
+          table: commerce_order_item__field_donation_code
+          field: field_donation_code_value
+          relationship: none
+          group_type: group
+          admin_label: ''
+          plugin_id: string
+          operator: '='
+          value: ''
+          group: 1
+          exposed: true
+          expose:
+            operator_id: field_donation_code_value_op
+            label: 'Donation Code (field_donation_code)'
+            description: ''
+            use_operator: false
+            operator: field_donation_code_value_op
+            operator_limit_selection: false
+            operator_list: {  }
+            identifier: field_donation_code_value
+            required: false
+            remember: false
+            multiple: false
+            remember_roles:
+              authenticated: authenticated
+              anonymous: '0'
+              neighbor: '0'
+              nonprofit: '0'
+              group_hub: '0'
+              manager: '0'
+              administrator: '0'
+            placeholder: ''
+          is_grouped: false
+          group_info:
+            label: ''
+            description: ''
+            identifier: ''
+            optional: true
+            widget: select
+            multiple: false
+            remember: false
+            default_group: All
+            default_group_multiple: {  }
+            group_items: {  }
       filter_groups:
         operator: AND
         groups:
BenStallings’s picture

Issue summary: View changes
rsnyd’s picture

I am experiencing the same thing. I've played around with the filtering as suggested by @BenStallings and while removing certain filters does finally provide some results in the downloadable file, I find that no matter what filters I use, if the total number results is > approx. 150 rows, the Batch method returns a nearly empty file. I am also using the views_data_export_phpspreadsheet module and my file DOES have the column titles, but that is all. Standard mode has the same limitations for me, so perhaps the issue is not in the mode selection?

BenStallings’s picture

I had a similar problem with another View, but in this case instead of returning an empty file, it exported the same 23 records regardless of the result set. Changing one of the text field filters from "Is equal to" to "Contains" fixed the problem. Considering my example above was also using the "=" operator, I think that may be our culprit.

grndlvl’s picture

Status: Active » Closed (won't fix)

This is caused by a bug in core https://www.drupal.org/project/drupal/issues/3403999 update to Drupal 10.2.2

BenStallings’s picture

Thank you, @grndlvl, you just saved me a day of tedious testing!