I'm trying to return the count of ER of a node in a view in rest export. I need to return 0 if actually there are none. The problem is that everytime there are no result "0" is returned as a string. Even if I try to manually rewrite it, it's always considered as a string, and not a number. Every other number is considered correctly a number, so without the "".

I tried various ways with the rewriting in twig code, but without any result.

Here's an example of my situation

enter image description here

Has anyone any idea on how i could solve this? Thanks

  • In Drupal 7, I had a similar issue, the problem is that PDO, the database driver, returns integers as strings. You'll probably have to implement a hook to override the view, casting the value to an integer. – Jaypan Apr 15 at 22:07

Your Answer

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

Browse other questions tagged or ask your own question.