---
title: "PCF - Multiple Autocomplete"
canonical: "https://support.appfire.com/space/PSJ/1589019900/PCF%20-%20Multiple%20Autocomplete"
format: markdown
---
> Macro (aura-html)

> Macro (button-handy)



## Examples

| **Example** | **Sample script** | **Sample display output** |
| --- | --- | --- |
| Using PCF - Multiple Autocomplete with SIL data source | This script retrieves usernames from specific groups (in this example, "jira-users") and filters them based on the search query. Only matching usernames are added as options to the custom field.<br>```
function getUsers(string [] groups){
  string [] users;
  for(string group in groups){
    string [] currentGrp;
    currentGrp = addElement(currentGrp, group);
    for(string user in usersInGroups(currentGrp)){
      users = addElementIfNotExist(users, usernameToUserKey(user));
    }
  }
  return users;
}
 
 
string [] groups = {"jira-users"};
string [] users = getUsers(groups);
string [] res;
for (string user in users) {
    if (contains(user, argv["query"])) {	
    	res = addElementIfNotExist(res, user); 
    }
}
return res; 
``` | "jsmith (John Smith)"  
"mjones (Mary Jones)"  
"rwhite (Robert White)" |
| Using PCF - Multiple Autocomplete with SQL data source | This query retrieves all user names from the database.<br>> ℹ️ Before using SQL data source, ensure you've configured the JNDI settings as detailed in the [SQL data source documentation](https://appfire.atlassian.net/wiki/spaces/PSJ/pages/1589019609).<br>```
select user_name from cwd_user;
``` | "jsmith (John Smith)"  
"mjones (Mary Jones)"  
"rwhite (Robert White)" |