3

I have a Taxonomy with a geographical hierarchy (Region > Province > City > District), which I'm adding to nodes using the Hierarchical Select module. Because I set the field to "store the full lineage", in effect what I get is a multi-value field with tids. In a simple View, this field displays as a comma-separated list of geographical areas in the right order (ie it behaves like a standard multi-value field).

I want to create Views to group and aggregate data by geographical area however, and in order to get this to work, it seems to me necessary to split the values out into separate columns (ie a column for "Region", another for "Province", another for "City" and so on). So far I have successfully managed to do this by using Views PHP to access each value in the array of values for the field and put the appropriate values into multiple columns (in effect, that means four "Views PHP" fields).

This works, but it seems to me a bit clunky and I would really like to know if there is a more elegant way, or even a module, to do this. I would have thought that this is quite a common sort of problem and I'm surprised that so far I've not been able to find anything to do it.

2
  • I have similar problem and the only way I found was using views_php too. In one case, the data is being downloaded to a csv file using views export. So it was easier to split the columns in Excel.
    – Z Z
    Apr 13, 2016 at 8:06
  • According to this article, Views PHP is a serious security risk: ohthehugemanatee.org/blog/2013/12/26/…
    – emma
    Jul 5, 2021 at 11:43

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.