Using the underscore in a suggestfunction effectively

I've got a pickerFieldCustom that is passing an "_" (underscore) to my suggestfunction.  My suggestFunction is a rule that has two paths through it. 

1) If the single parameter passed in contains a space it splits the incoming text into two parts and runs a query Entity containing a logicalExpression "AND" that applies the first part to a queryfilter searching on a first_name field, and the second part to a queryFilter searching on a last_field.  e.g.  I pass in Ric Nol and any rows that contain that, for example first_name=Richard, last_name=Nolan would match..   OR

2) The single parameter contains no spaces, the rule runs a queryEntity that searches using a logicalExpression "OR" that runs two queryfilters, where first_name or last_name is searched for a match.  E.g.  I pass in "richard" and the query returns firstname="Richard", last_name="Nolan   AND first_name="Mike", last_name="Richards"

The rule runs fine, but the suggestFunction seems to do something via that "_" (underscore) parameter that treats the " " (space) as a deal breaker.

 

Can anyone explain the mechanics of that construct?

Is there some other way to break that "_" into two parts?  Can we run evaluations like search(" ",_,0) and somehow an insulated value down?

 

Thanks!

  Discussion posts and replies are publicly visible