0

I have a content-type called content_A which has a reference field pointing at a user (ref_user) and a workflow field with three states.

I want to make a table using views that filters on workflow state_X and only show content where ref_user points at the same user who is logged in.

I can filter the content on the logged in user with contextual filter and that seems to work and I'm also using a relation to access the content that is referencing the logged in user. The problem is that I can't get the state filter to work, it only returns an empty result.

There are two fields that I can chose from in the filter section, the first lets me fill in a string that the state should be equal to but that doesn't work at all unfortunate (I have a space character in the state name, could that be the problem?). The second is "Workflow current: New state name" under "workflow current", which lets me select a decidable state from a drop down menu. But then I get the following error in my select query:

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'node.nid' in 'where clause'


Edit: For those who want to know, I found the solution. Turns out that you should not compare the state with its label or "state string", but instead with its state id. It sounds logical when I think about it but was not mentioned in the documentation (as well as I know)

  • I am in the same situation, could you please specify the views filter you used and how you got your state id? Thanks. – Toki Mar 2 '16 at 16:11
  • I got the state ID by looking at the workflow field in my content type. If you edit the workflow field under content-types, will you see a box containing the state labels and its state ID. Looking back at it I think it would be better to compare with the state label instead? Settings these ID numbers hard might cause problems in the future if you want to edit the workflow. Hope it helps – Fever Mar 4 '16 at 9:46
  • I have found the box with state IDs, thanks. Last question, could you specify the Views filter you have chosen? – Toki Mar 4 '16 at 16:27
  • I just select the workflow field from my content type when I add the filter and set it to campare with a state ID. And as I mentioned you want to compare this field with a integer value (the sid). – Fever Mar 5 '16 at 23:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.