Body: <p>We are using Civi (version 4.6.3) primarily as a case management tool. </p>
  
  <p>In Advanced Search, when I try to create a query with more than one Custom Field Set used for two different Case Activities, the search falsely returns no results. </p>
  
  <p>I recreated the error in demo -- I created two new custom fields to extend two different Case Activities for Housing Support Case Type :
  1. Activity: Secure Temporary Housing
     Custom Field Set: case-housing1-test 
     Field: Housing Status (dropdown select options:Temporary Housing, Homeless)
  2. Activity: Long-term Housing Plan
     Custom Field Set: case-housing2-test 
     Field: Is long term plan complete? (yes or no)
  I created a new contact: Joe Jack, and then created a Housing Support Case for him. In Secure temporary housing activity, Housing Status, I selected "Homeless". In Long-term housing plan activity, I selected "yes" to the question "Is long term plan complete?" .
  Now if you go to Advanced Search and do a search for Activities, housing status - Homeless, long term plan complete - yes,  the search returns no records. If you do a search for housing status - homeless, you get Joe Jack.  If you do a search for long term plan complete - yes, you get Joe Jack.  But if you do a search for both you get nothing.</p>
  
  <p>I believe the reason for this is that it doesn't recognize that the two activities belong to the same case. I was able to pull the correct results in a custom report I created by creating a view  for each activity type and joining them in a SQL statement on case id.  </p>
  
  <p>Also,this is a separate issue, in Search Builder, when I search a custom field used for Activities where field IS NULL , it returns all records where that field IS NOT NULL but the value in the column shows the field is empty.
  <a href="https://i.sstatic.net/y0vBH.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/y0vBH.png" alt="screen shot 1 - gender is null"></a>
   If I do the same search but instead ask for records where field IS NOT NULL, it returns all the same records but this time the actual value is displayed in the column.
  <a href="https://i.sstatic.net/No5zI.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/No5zI.png" alt="screenshot 2 - gender is not null"></a>
  This is also true for is empty, is not empty.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-08-26T02:07:02.543Z
Comments.Text: Please edit your question to provide more information. What is your civi version? What search screen are you using exactly? Can you provide a screenshot? Can you reproduce this problem on the demo site?
Comments.UserDisplayName: Coleman
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-08-31T14:06:40.017Z
Comments.Text: I am aware that in a localised version of civicrm the IS NULL is twice in the list. The first one meaning IS EMPTY which differs from IS NULL.
Comments.UserDisplayName: Jaap Jansma - CiviCooP
Tags: <search>
Title: Problem with Advanced Search and Search Builder
ThreadText: # Problem with Advanced Search and Search Builder
  
  (Asked by: username_0 on 2015-08-25)
  
  We are using Civi (version 4.6.3) primarily as a case management tool.
  
  In Advanced Search, when I try to create a query with more than one Custom Field Set used for two different Case Activities, the search falsely returns no results.
  
  I recreated the error in demo -- I created two new custom fields to extend two different Case Activities for Housing Support Case Type :
  1. Activity: Secure Temporary Housing
  Custom Field Set: case-housing1-test
  Field: Housing Status (dropdown select options:Temporary Housing, Homeless)
  2. Activity: Long-term Housing Plan
  Custom Field Set: case-housing2-test
  Field: Is long term plan complete? (yes or no)
  I created a new contact: Joe Jack, and then created a Housing Support Case for him. In Secure temporary housing activity, Housing Status, I selected "Homeless". In Long-term housing plan activity, I selected "yes" to the question "Is long term plan complete?" .
  Now if you go to Advanced Search and do a search for Activities, housing status - Homeless, long term plan complete - yes, the search returns no records. If you do a search for housing status - homeless, you get Joe Jack. If you do a search for long term plan complete - yes, you get Joe Jack. But if you do a search for both you get nothing.
  
  I believe the reason for this is that it doesn't recognize that the two activities belong to the same case. I was able to pull the correct results in a custom report I created by creating a view for each activity type and joining them in a SQL statement on case id.
  
  Also,this is a separate issue, in Search Builder, when I search a custom field used for Activities where field IS NULL , it returns all records where that field IS NOT NULL but the value in the column shows the field is empty.
  [![screen shot 1 - gender is null](https://i.sstatic.net/y0vBH.png)](https://i.sstatic.net/y0vBH.png)
  If I do the same search but instead ask for records where field IS NOT NULL, it returns all the same records but this time the actual value is displayed in the column.
  [![screenshot 2 - gender is not null](https://i.sstatic.net/No5zI.png)](https://i.sstatic.net/No5zI.png)
  This is also true for is empty, is not empty.
  
  **Tags:** search
  
  > **Comments:**
  > **username_1**: Please edit your question to provide more information. What is your civi version? What search screen are you using exactly? Can you provide a screenshot? Can you reproduce this problem on the demo site?  
  > **username_2**: I am aware that in a localised version of civicrm the IS NULL is twice in the list. The first one meaning IS EMPTY which differs from IS NULL.  
  
  ---
  
  ## 0 answers
  
  