2

I am getting exhausted trying to filter views by matching 2 fileds value from 2 different content types.

For Example:

  • Content Type (Employee A), with the following fields:

    • ID (integer)
    • Name
    • phone Number
    • Address
  • Content Type (Employee B), with the following fields:

    • ID (integer)
    • Position
    • Skills
    • Salary

What I need to do is a View that show

ID, Name, phone Number, Address, Position, Skills, Salary ... By comparing ID integer value from (Employee A) = ID integer value from (Employee B)

Please help me doing this.

1
  • Making new site or working old site ? which datatype you are using to store common value? Drupal 6 or 7 ?
    – Rupesh
    Jan 2, 2015 at 0:55

1 Answer 1

4

Install Equi Join.

The Equi Join module allows you to create relationships between different entities based on an arbitrary field. This allows the use of relationships in Views without having to add Node References to a content type, which may not be an option when displaying data stored on a third-party database or data provided through custom Views handlers. That said, it works with nodes as well.

I must confess, I have never used this module before now, so my method of getting it to work was by trial and error. Here goes:

In your view, add a relationship Equi Join: Content, and configure both left field and right field to be on field 'ID' (I am assuming you re-used the ID field for both Employee A and Employee B. If not, adjust as appropriate). Make sure to provide a unique Identifier (will be used later to identify the relationship).

Add all the fields from Employee A and Employee B. For each of the fields of Employee B, make sure to add the relationship of the equi join.

Add Filter Criteria for each of the fields (AND). For all of them, Operator must be Is not empty (NOT NULL). For each of the Filter Criteria using fields on Employee B make sure to add the relationship of the equi join. If you have a required field on any of the Employee Types, then adding just that one required field would be sufficient for that Employee Type. If none of the fields are required, then you might end up filtering out a legitimate row with empty values. So best if each employee type has at least one required field on it.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.