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

seth21ti’s picture

i have the same problem. it's only work when i remove batch creation. Any help?

davidthou’s picture

I'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.

dpearcefl’s picture

Version: 7.x-3.0-beta5 » 7.x-3.0-beta6

I'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.

wildermuthn’s picture

Having same problem.

dpearcefl’s picture

dpearcefl’s picture

Version: 7.x-3.0-beta6 » 7.x-3.x-dev

I 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.

dpearcefl’s picture

Don'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:

            [good_field] => 1412888735
            [views_php_field] => Array
                (
                    [10-9-2014] => 10-9-2014
                )

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.

retiredpro’s picture

Issue summary: View changes

Here 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.

SilviuChingaru’s picture

Status: Active » Closed (works as designed)

The 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.

Tomim’s picture

Thank you very much retiredpro!
It works!