Greetings,

Is there any way to name/id each field in the matrix so that the individual fields (cells) become available within Views?

Thanks in advance,

Scott

Comments

aaron1234nz’s picture

Category: support » feature

I think it is possible to implement this feature, it will take a fair bit of work to achieve this.

Do you want to simply display a single field from a matix field, or to be able to filter/sort by that field?

scott859’s picture

Thanks for your reply.

Yes, I would like to be able to filter/sort fields that are in matrix.

Scott

aaron1234nz’s picture

Version: 6.x-2.0-alpha1 » 6.x-2.x-dev

I've made the first step by allowing you to pick individual cells from a matrix field to display in a view

scott859’s picture

Great, and thank you!

Scott

alexandreracine’s picture

Keeping track.

ellanylea’s picture

related Views feature requests:

1. Would it be possible to make matrix field a filter so that it can be exposed and users can search for content inside the matrix field.

2. Would it be possible to make one column of the matrix available as a field. For example, the matrix has 3 columns: university, start year, end year. In the Views page, it'd be great to show just the university field (no need to show start and end year in Views, but available on node).

Thanks so much for the extra widgets and everything you've done so far. Much, much appreciated.

rares’s picture

StatusFileSize
new743 bytes
new6.71 KB
new6.48 KB

Hi: I needed views on the 6.x-1.4 branch because I had some issues with 2.x.
I used the great code that @aaron1234nz wrote and ported it for 6.x-1.4. You can find the full 6.x-1.4 module attached with views included.
Aside from adding the three views-related files, the only change to the current code is the addition of the views api hook in matrix.module (patch file attached).
There is also a version with comments: just search for "PORT" to see what changes were made.

davej’s picture

@rares: Thanks for the 6.x-1.4 views backport.

I'm having problems using this with relationships in views, though. When I add a Matrix cell as a field in a view, the relationship that I want to use - which is a relationship via CCK Revision Reference from content type A to a revision of content type B - is missing from the Relationships select. However if I select "Do not use a relationship", the view somehow finds a node of the correct content type B and displays the Matrix cells from that - but this appears to be an arbitrary type B node with no obvious relevance to the original type A node: in fact the same type B node is displayed every time.

The SQL query shown in views preview does not include table node_field_matrix_data at all, which puzzles me!

I was hoping to use this on a project that's getting pretty urgent so if you could give any indication of whether this might get fixed in a day, a week or a year, that would help me decide whether to ditch Matrix or hold out. Meanwhile I'll try 6.x-2.x-dev.

Thanks,

Dave J

davej’s picture

Update: I tried upgrading from @rares' 6.x-1.4 views backport to 6.x-2.x-dev and this broke my existing Matrix fields. In node view they now each display 3 times. In Content type -> Manage Fields, they each have phantom additional rows that I can't delete. In Views admin, the relationship mentioned in #8 is still missing. In Views output, the Matrix fields are now all blank. So don't try that. I took a backup. I'll now try deleting the Matrix fields and recreating under 6.x-2.x-dev .

OK, tried that. I found various detritus lying around. Even after deleting all the Matrix fields, clearing the cache, disabling and uninstalling the module, truncating the sessions table and all cache% tables, there are still loads of phantom Matrix fields appearing as choices in Views admin add field. Where is this being stored?

The relationship mentioned in #8 is still missing. In Views output, the Matrix fields are still all blank.

Thanks aaron1234nz and rares for your work on Views integration, not working yet for my case, however.

Dave

davej’s picture

StatusFileSize
new986 bytes

This patch adds support for joins to node_reference. It solved my problem with relationships via CCK revisionreference fields. Patch is wrt matrix-6.x-2.x-dev 2009-07-25, following content.views.inc .

Dave

davej’s picture

I ran into another problem with views in 6.x-2.x-dev: if a matrix field has a cell with options, e.g. a checkbox field, then none of the cells for this field are available as fields in views. I tracked this down to unserialize failing on $field['rows_elements'] when the options field contains line breaks. The attached patch has a fix for this, following the way unserialize is used in matrix.module, together with the fix from #10.

introfini’s picture

Subscribing

nimi’s picture

I installed the patch added the handlers.
For some reason Views is displaying the wrong values.

Any idea how to fix this?

Nimi.

harrrrrrr’s picture

@ #7 rares

I installed your 1.4 version with views support. It doesn't show any value's when i use the matrix fields in a view..

drupov’s picture

subscribe

Wild Boar’s picture

I'm still missing something here. I applied the patches, created 3 nodes with a node type that includes the matrix field, went to create a view but all I see is the matrix field value for one row. Is this just not usable with views yet? This will be a great module when it has full views integration. Looking forward to it.

mehtatejas’s picture

Any updates?
Even I would also like to use this module in views

intrafusion’s picture

Status: Active » Closed (won't fix)

Marking as Closed (won't fix) as the new co-maintainer will be focusing on D7