0

I've got a view that outputs a pdf business card for every student with all the classes he attends. Someting like this:

2014
Name Surname
class1, class2, class3

To associate students and classes I use a Session content type with fields: year, entity referenced student and entity referenced class (Students and Classes are separated content types as well).

Because I need to control the exact position of every field on the final pdf, I use views PDF. To achieve that some kind of "GROUP_CONCAT" on classes I succesfully used Merge Rows module.

My query is ok. If I try it on page display everything is all right, but when I try to make a PDF display using views PDF it shows just one value, not the entire comma separated string of classes. I've tried many combinations of merge rows settings, played with custom html output of fields, but it seems that Merge Rows doesn't work on PDF display. Any idea to make this work?

As suggested for invoices in the paragraph "Append and Include other Views" from views PDF documentation, I also tried to split the view into two separate views: the main and the secondary view of classes included as a field but with no success. The classes view doesn't filter content using the contextual filters passed by the main view. Removing contextual filter, I can see classes under student name, but all of them. And the query is really slow...

Another solution could be to rewrite the SQL using GROUP_CONCAT (I use MySQL)... But how?

What should I do?

Thanx in advance

0

Finally I solved applying this patch to views in order to get GROUP_CONCAT as an aggregate function in views UI and uninstalled views_merge_rows. I think this is a better solution from a sql query performance point of view: views_merge_rows simply changes how data appear. Probably I was wrong in configuring something in it but I won't investigate any more.

Thanx all for reading... ;-)

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.