I want to output a boolean value like this:

if some field value (e.g. [comment_count]) > x (my constant, e.g. 5) = 1, else 0

without installing Views PHP (or other modules) or having to create a field.

I tried with the Views field "Global: math expression" but that won't support comparisons.

Is there a math expression or another simple way to do this within my view?

PS: I thought I could use floor(logX([comment_count]) but logX() seems not supported: it always returns 0. Custom base logarithm is among PHP math functions but not present in Views? :(


Easiest method is to either use hook views view pre render out a preprocess function.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.