List Collector Variables and ‘Contains’ Search

I have encountered several scenarios when someone wants to search for a value in a List Collector variable, but the default “starts with” search is insufficient. This is typically when multiple columns are visible in the List Collector (also known as a “glide_list” variable; formerly known as “slushbucket” variable, but I think we’re trying to move on from that term) or when the variable values are lengthy. It seems like there should be a reference qualifier attribute that enables a “contains” search instead of a “starts with” search, but there isn’t. The attribute ‘ref_ac_columns_search’ set to “true” will allow all columns included in the “ref_ac_columns” attribute to be searched, but it doesn’t enable “contains” searches. Teaching your users to do a wildcard search (*searchterm) is probably not going to stick except for power users and people who give a damn.

The way to address this is to create a User Preference with the table name used in the List Collector variable and ending with “.autocomplete.contains”. The ‘System’ checkbox on the user preference must be marked as “true”, as well, unless you wanted to create a preference for every user in your system (you don’t).

Example:
If I have a List Collector variable set up against the Group (sys_user_group) table and want my users to be able to search for any part of the ‘Name’ or ‘Description’ field on the group table, the ‘Variable attributes’ value on the variable would be something like…

glide_list,ref_auto_completer=AJAXTableCompleter,ref_ac_columns=name;description,ref_ac_columns_search=true

(Yes, the ‘name’ being a part of ref_ac_columns is unnecessary, but I wanted to include it for the sake of the example.)

I would then create a new user preference with the following:

  • Name = sys_user_group.autocomplete.contains
  • System = true/checked
  • User = empty
  • Type = true | false
  • Value = true
  • Description = Use a ‘contains’ query on Group reference autocomplete

Adding a ‘Description’ to the User Preference is a good idea for the next person to come along (which is most likely going to be you).

This will end up affecting more areas than just the variable you’re working with, but it’s probably beneficial in other areas of the platform.

One more thing to note: the system property ‘glide.ui.ref_ac.startswith’ must not be set to “true”. That system property disables “contains” searches in reference fields whether you use a * or have a user preference set up. This is surely a legacy property from a time when querying was a challenge, but I think it’s a solved problem at this point. “Contains” search all you want.

Ok, now really one more thing to note. Enabling ‘contains’ auto-complete search is documented in Product Docs already, but it’s at the bottom and good luck finding search terms that will surface it.

Leave a Reply