I have a File view, i.e. a view of type "File" whose base table is {files}. I would like to list only files that are present in a specific filefield. Typically, this would be done via a FileField relationship in the view, that joins the file table to the node table (via the various CCK tables). Is that currently possible?

The Upload: Node relationship, for example, implements this join between files and the nodes where they were uploaded via the Upload module.


Category:support» feature
Status:Active» Needs review
new1.35 KB

Attached is a patch to achieve what I need. In filefield_field_settings_views_data, I add the necessary declarations to find a "Content: Node" relationship that, when marked as required, shows only files that are attached to a certain filefield, and exposes the associated node data.

Hm, interesting... I think this makes sense to include, but you could actually already accomplish the same thing if you started with a view of type "Node", then made a relationship over to the Files table. This patch just makes it so that you can do it both directions.

You're right, but in my case, I cannot start with a "Node" table, for other reasons.

new1.37 KB

Attached is a slightly modified version where the new relationship is named after the field's label, instead of the generic "Node" label. This works better when multiple filefields exist.

Status:Needs review» Fixed

Patch works great. Thanks for your contribution infojunkie! Committed and will be in the 3.3 version.

Title:How can I link a File view to a filefield?Add relationship to the Node table based on FileField tables

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.