Body: <p>I'm using the <a href="https://github.com/TechToThePeople/publicautocomplete" rel="nofollow noreferrer">Autocomplete</a> extension and it works as advertised.  However, I was hoping someone could help me customize the output of the autocomplete.</p>
  
  <p>I would like to include all of the Organization contact_type entries as well as several subgroups while excluding others. </p>
  
  <p>Below will filter out the contact_sub_types, but also filters out any of the parent Organizations that do not have a subtype. How do I return a display_name for Organizations with no subtype as well as subtypes</p>
  
  <pre><code>global $civicrm_setting;
  $civicrm_setting['eu.tttp.publicautocomplete']['params'] = array(
    'contact_type' =&gt; 'Organization',
    'contact_sub_type' =&gt; array('NOT LIKE' =&gt; "Facility\", \"Legislation\", \"Contract"),
    'return' =&gt; 'display_name'
  ); 
  </code></pre>
  
  <p>Thanks in advance for your help.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-02-19T09:21:00.767Z
Comments.Text: Can you approach it a different way and select based on group / tag / custom field etc rather than subtype?
Comments.UserDisplayName: Aidan
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-02-20T18:05:23.547Z
Comments.Text: Thanks for replying Aidan.  I have thought of that and that might be a good work around, but I would still have to update the tags every time someone signs up for an event to make this work and I was hoping to automate the process more.
Comments.UserDisplayName: jansmath3
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-02-20T20:11:16.737Z
Comments.Text: Is there a way to add a null value to the array like global    `$civicrm_setting;
  $civicrm_setting['eu.tttp.publicautocomplete']['params'] = array(
    'contact_type' => 'Organization',
    'contact_sub_type' => array('LEA','School','School_Headquarters'),
    'return' => 'display_name'
  );`
Comments.UserDisplayName: jansmath3
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-02-20T20:17:52.117Z
Comments.Text: contact_sub_type' => array('LEA','School','School_Headquarters'**null or '' or 'null'**?
Comments.UserDisplayName: jansmath3
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-02-21T10:03:09.047Z
Comments.Text: You can find just those with no subtype using   `'contact_sub_type' => array('IS NULL' => 1)`  but I don't know that the api lets you do what you need.  You mention updating when someone signs up for an event - maybe look at smart groups?  You might need to expand the question a bit as to how event signups affect the organisations you want to show for autocomplete.
Comments.UserDisplayName: Aidan
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-02-21T15:33:55.787Z
Comments.Text: Thanks @Aiden. I think you're right that I need to delve into the actual requirements here first.  It looks like the best option for us is to create two profile fields.  One is "School Affiliation" that only applies to the subtypes of 'LEA', 'School', 'School_Headquarters'.  We then would have an optional non-autocompleting 'Organization' profile field for everyone who is not associated with a school to limit the number of public facing organizations we are showing to end users.
Comments.UserDisplayName: jansmath3
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-02-21T15:34:00.487Z
Comments.Text: However, I don't think the autocomplete extension can differentiate two different current_employer fields as is.  Maybe it's time to look at using drupal webform for events so that I can display both fields as well as making the second field a contextual field that only pops up if there is "No school affiliation".
Comments.UserDisplayName: jansmath3
Tags: <autocomplete>
Title: AutoComplete Profile Question
ThreadText: # AutoComplete Profile Question
  
  (Asked by: username_0 on 2018-02-15)
  
  I'm using the Autocomplete extension and it works as advertised.  However, I was hoping someone could help me customize the output of the autocomplete.
  I would like to include all of the Organization contact_type entries as well as several subgroups while excluding others. 
  Below will filter out the contact_sub_types, but also filters out any of the parent Organizations that do not have a subtype. How do I return a display_name for Organizations with no subtype as well as subtypes
  global $civicrm_setting;
  $civicrm_setting['eu.tttp.publicautocomplete']['params'] = array(
    'contact_type' => 'Organization',
    'contact_sub_type' => array('NOT LIKE' => "Facility\", \"Legislation\", \"Contract"),
    'return' => 'display_name'
  ); 
  
  Thanks in advance for your help.
  
  **Tags:** autocomplete
  
  > **Comments:**
  > **username_1**: Can you approach it a different way and select based on group / tag / custom field etc rather than subtype?  
  > **username_0**: Thanks for replying username_1.  I have thought of that and that might be a good work around, but I would still have to update the tags every time someone signs up for an event to make this work and I was hoping to automate the process more.  
  > **username_0**: Is there a way to add a null value to the array like global    `$civicrm_setting; $civicrm_setting['eu.tttp.publicautocomplete']['params'] = array(   'contact_type' => 'Organization',   'contact_sub_type' => array('LEA','School','School_Headquarters'),   'return' => 'display_name' );`  
  > **username_0**: contact_sub_type' => array('LEA','School','School_Headquarters'**null or '' or 'null'**?  
  > **username_1**: You can find just those with no subtype using   `'contact_sub_type' => array('IS NULL' => 1)`  but I don't know that the api lets you do what you need.  You mention updating when someone signs up for an event - maybe look at smart groups?  You might need to expand the question a bit as to how event signups affect the organisations you want to show for autocomplete.  
  > **username_0**: Thanks @Aiden. I think you're right that I need to delve into the actual requirements here first.  It looks like the best option for us is to create two profile fields.  One is "School Affiliation" that only applies to the subtypes of 'LEA', 'School', 'School_Headquarters'.  We then would have an optional non-autocompleting 'Organization' profile field for everyone who is not associated with a school to limit the number of public facing organizations we are showing to end users.  
  > **username_0**: However, I don't think the autocomplete extension can differentiate two different current_employer fields as is.  Maybe it's time to look at using drupal webform for events so that I can display both fields as well as making the second field a contextual field that only pops up if there is "No school affiliation".  
  
  ---
  
  ## 0 answers
  
  