OK, so this is a bit tricky, let's see if you can follow my problem: (just let me know which part you don't understand 1,2,3...) I am using Drupal 7
1) I have 2 content types: Workers and Documents
2) In the content type Documents I have the entity reference field of all the workers. (Eg. I want to add a document/node that refers to a specificic worker John)
3) In the content type Documents there is a list field the user can select two options: red or green (it's a field where the user can say the document is OK to use)
4) Everytime I add a Document, I have to select red or green in that field.
5) Right now, I am displaying a view with all the nodes/documents from the content type Documents refering to the title and List field (red or green). Something like this:
Document 1 ------------------ red
6) On another page, I am displaying a view with a list of all workers (Content type Workers) and here comes the tricky part:
I want to add a field in this view displaying red or green based on this condition: IF (all the Documents from the entity reference "specific worker" have "green" on the field): display green. IF (one of the Documents has the field "red"): display red
It will diplay something like:
John --------------- green
How can I achieve this with views? Do I need to write code? Thank you.