Closed (won't fix)
Project:
Views PHP
Version:
6.x-1.x-dev
Component:
Sort Handler
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Anonymous (not verified)
Created:
29 May 2011 at 14:38 UTC
Updated:
26 Feb 2019 at 21:00 UTC
Jump to comment: Most recent
Comments
Comment #1
infojunkieInsert
dsm($row1);before the return statement. Is yourexpressionfield correct?Comment #2
Anonymous (not verified) commentedThank you for your answer,
The output is expression (NULL) on every row, but the preview displays the score ok.
Comment #3
infojunkieThat's your bug. Are you using a Global: PHP field for expression? In that case, make sure you have the value computed in the "Value code" area of the field settings.
Comment #4
Yanxi commentedI'm having the same problem. After insetting dsm($row1); I get a result of each Global: PHP field as (NULL). But they display the correct result in the preview. I've set the correct value in the "Value code" area as well. Just can't make the sorting work!
Comment #5
infojunkie@Yanxi: You're probably not using the latest Views PHP dev version. Please update and let us know.
Comment #6
Yanxi commentedThanks for your prompt reply infojunkie. I actually downloaded it yesterday. I used print_r($data) and it clearly shows the correct result. But when I used dsm($row1); only the non-php fields' correct results are displayed. All the Global: PHP fields are (NULL). Bizarre!
Comment #7
infojunkieI took a look at the code for Global: Math expression field. Unfortunately, it doesn't compute its value until rendering time, which means it cannot be used for sorting purposes. Because this handler is part of Views core, nothing much can be done here. Sorry!
Comment #8
Yanxi commentedI might be missing something. I use 3 Global:PHP fields in my view. The first two are using some sql query to return voting results (number) from the database. The third one is to sum the first two's results. I didn't see Global: Math expression field. Are they the same? I don't know what this Math expression field refers to. I did a bit search on drupal site and didn't find any information about it.
Comment #9
infojunkie@Yanxi: the Global: Math expression field is supplied by Views core, not by Views PHP. That's why I suspect you're dealing with a different issue.
Comment #10
Yanxi commentedSorry, my fault. So should I open a new issue? My problem is quite similar to the original post but I am not using Global: Math expression field.
Comment #11
infojunkieYes please.
Comment #12
Yanxi commentedI opened a new issue #1178170: Cant sort