Combine 2 columns into 1?

Events happening in the community are now at Drupal community events on www.drupal.org.
kirkhings's picture

I've got two content types, both have a node title and a document attachment, the doc attachment fields are different names (being from two different content types).

In my view, I'm displaying the node title and the file name in a table. The node titles are great all in one column, but the two content typed attachment fields are displaying in two separate columns, making three columns total when there should only be two. Every row has a single doc title, but one or the other column is always blank now depending on which content type's doc title is displayed.

How can I combine these two fields to display in the same column so it looks seamless? It is not important to know that these docs came from two different content types. These are organized by larger taxonomy terms so it's not feasible to just do two different views.

Thanks in advance for your advice

Comments

The Views Developers group

mfb's picture

The Views Developers group is for development discussion, support questions are not appropriate here. See the views help (which is also available on your own site) at http://views-help.doc.logrus.com/help/views/style-table

I apologize and thank you. I

kirkhings's picture

I apologize and thank you. I had looked at the column configs and did not realize it was key to my solution. Thanks. Perhaps clearer explanatory text could be added right in the config area? Just a suggestion for views development 8^)

make a handler with CONCAT

enboig's picture

I have developed a module to "sum" two columns, but I have made it so you can easily add another handler to CONCAT() as much fields as you want, or use other SQL functions.
I can send you my code (most of it based on views_groupby and views_calc) so you can copy and extend it. If anybody is interested in mantaining this code I have no problem; but I lack cvs language to post this module (and some more).
The advantage of using SQL vs style is that you could implement a "search filter" on both fields at once, or sort them using ajax, ....

Views Developers

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: