Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Not sure if this is an issue for here or elsewhere. We're using Views PHP to calculate some fields inc a view, which then we try to export through Views Data Export.
The PHP calculated fields show up fine in the export preview on the views page, but are empty in the actual download.
If we don't batch the creation of the file, then they display fine.
Comments
Comment #1
seth21ti CreditAttribution: seth21ti commentedi have the same problem. it's only work when i remove batch creation. Any help?
Comment #2
davidthou CreditAttribution: davidthou commentedI'm experiencing the same issue: PHP filter is not working using batched export.
However I haven't tried this on version 7.x-3.0-beta6 yet.
Comment #3
dpearcefl CreditAttribution: dpearcefl commentedI'm seeing the same problem. Shown in the Views preview but does not appear in the actual download.
Views Bonus Pack 6.x-1.1 works as expected.
Views data export 6.x-2.0-beta6 does not work.
Using Views PHP 6.x-1.x-dev (2011-Jun-22)
Wish I know if this was Views PHP or Views data export.
Comment #4
wildermuthn CreditAttribution: wildermuthn commentedHaving same problem.
Comment #5
dpearcefl CreditAttribution: dpearcefl commentedPossibly related issues:
http://drupal.org/node/1132978 (D7)
http://drupal.org/node/1088776 (D7)
Comment #6
dpearcefl CreditAttribution: dpearcefl commentedI can reproduce this under the dev version of this module and the dev version of Views PHP and the dev version of Views.
If I turn off the batch support in views for this display, the fields will export.
Comment #7
dpearcefl CreditAttribution: dpearcefl commentedDon't know if this is helpful, but I took a view with a "Views PHP" field that wasn't exporting, ran it through views_get_view_result() to get an array of the results. When I ran it through print_r(), I saw something interesting. This is one good field and one "Views PHP" field:
The results from the Views PHP field is an array rather than a string. Could this be the problem? Maybe if the results are a single element array, just use the value of the element?
If I knew where in the Views data export code to look, I'd fix it.
Comment #8
retiredpro CreditAttribution: retiredpro commentedHere is my workaround for getting php calculations to show on batched exports.
On the normal page view, setup the php field as you normally would within the Value code textarea field.
On the export page, override your php field and move your php code from the Value code over to the Output code section. Modify your code where necessary such as changing 'return' into 'print', etc.
So now I have a view that shows me the php values with sorting ability since I wrote it in the Value code. and then I have a separate view for exporting that works by going through the Output code area. Its a hassle since my fields are no longer in sync but at least I can batch export now.
Comment #9
SilviuChingaru CreditAttribution: SilviuChingaru commentedThe problem is not related to VDE but to Views PHP. Everything related should be discussed on Views PHP Issue page not here. Check #1088776: Views PHP pre and post execute extender implementation, especially #16 and the patch in #17.
Comment #10
Tomim CreditAttribution: Tomim commentedThank you very much retiredpro!
It works!