I'm building an information website for an author who has written about 100 books. Nodes giving information on each book can be created by users. All the book titles are contained in a taxonomy vocabulary. The "book node" content type contains a term reference field which associates the node with the relevant book title.

Only one node for each book should exist, so I created a taxonomy flag allowing users to "volunteer" to create the node for the associated book and a view to show all unflagged terms in that vocabulary, so this becomes a list of "book nodes that need creating". This works fine until a user creates a book node without "volunteering" to create it, so the "book nodes that need creating" list is out of sync with the book nodes that actually exist.

Ideally what I want is a view which effectively lists the "book nodes" that haven't yet been created, so that users can only volunteer to create nodes that *need* to be created. But of course this is basically a view of content that doesn't exist yet. I've tried views both term-based and node-based, fiddling inexpertly with relationships, and trying to show terms not so far associated with nodes, but can't work it out. Is what I want possible??

Comments

johnv’s picture

You can create a table view of Term References. Then you have a LEFT INNER JOIN of Terms vs Nodes.
1. Creat a new view of Terms
2. add a relationship of field_term_reference (use you own fieldname). make sure you choose the 'reverse' variant.
3. add fields tid(no relationship) + nid(relation of field_term_reference)
4. Show your view: no node = no nid!

Beware: if you add another table, the list will be truncated! Then you will need the module Views_PHP to add a PHP_filter. (or some other method to filter after the SQL-query.)

thoughtcat’s picture

Many thanks for the quick reply! Using your instructions I've managed to create a table showing the NID, term ID and the term from the "associated titles" vocabulary (the term reference field that contains the book titles). However, the one thing I don't get in your instructions is the "reverse variant", so my view is currently listing titles that DO exist, rather than the other way round. Can you tell me where I choose that option?

johnv’s picture

Well, the 'reverse variant' apparently only exists for node references, not term references.

I tried to reproduce for your case, and I succeeded using below settings, showing all departments with/without content:
RELATIONSHIPS
Taxonomy term: Content using Department
FORMAT
Format:Table | Settings
FIELDS
Taxonomy term: Name (Name)
(field_hr_department) Content: Nid (Nid)
FILTER CRITERIA
Taxonomy term: Vocabulary (= HR: departments)

Damien Tournoud’s picture

I think in your case it would makes a lot more sense to create book stubs as nodes.

thoughtcat’s picture

@Damien, thanks - do you have any suggestions for how I can do that? I couldn't easily find a module that created a batch of nodes quickly with key fields populated, which is what I imagine is the sort of thing you mean.

couturier’s picture

I'd create the 100 nodes myself and then let users edit them. 100 is such a small number, comparatively.

thoughtcat’s picture

Fair point, I think this is probably what Damien meant by "stubs". Is there a quick way of mass-creating 100 nodes or do I have to create them manually one at a time?

couturier’s picture

Just get in there and create them one by one. It will end up being a small percentage of a workday. I did this for over 500 nodes I needed to re-create on a site recently, and it didn't take that long, relatively speaking. Spend enough time to perfect the first one just like you want it, though. You don't want to have to go back and make some small adjustment to all of them after they are all done.

MustangGB’s picture

Issue summary: View changes
Status: Active » Fixed

Status: Fixed » Closed (fixed)

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