This content has been marked as final. Show 5 replies
not sure why it does not work - i have not used or tested having to
wildcard characters in same value.
i am pretty sure separating your WHERE clause into 2 (or 3) separate
ones with OR operators will do the trick, though:
SELECT DISTINCT collegeName
collegeName = <cfqueryparam value="#arguments.suggestvalue#"
OR collegeName LIKE <cfqueryparam value="#arguments.suggestvalue#%"
OR collegeName LIKE <cfqueryparam value="%#arguments.suggestvalue#"
I just tried that and while I agree it should work, it doesn't. I'm starting to think this is a setting in the autosuggest feature built in to CF. Not show how they are doing that though. If I switch the CFC to JUST the '%value' clause, I get no results no matter what I type, so it seems like they are preventing that.
I am returning the values as a string of values (1,2,3,4) instead of an array, so I wonder if that makes any difference.
if you run the query outside of the autosuggest, does it return all the
expected results? i mean, it is just a query - it should return what it
finds, autosuggest or not...
do you have any values with 'ohio' in the middle?
if you omit the <cfqueryparam> and just use LIKE
'%#arguments.suggestvalue#' in your query - does it change the results?
also, just found a suggestion on livedocs:
... LIKE '%' + <cfquerypama without any % in value> + '%'
see if above works...
For example, if I pass "Notre" to the CFC, I get an array back with "Notre Dame College, Notre Dame Seminary, College of Notre Dame, University of Notre Dame". But when the same value ("Notre") is passed and used in the autosuggest, I only see "Notre Dame College, Notre Dame Seminary".