Workflow Query Tool code for Fuzzy Address Numbers
I'm new to VBScript and am not sure how to write the query that I want (or more correctly, to do the preprocessing required to run the query that I'm using).
I've got a workflow that includes a query tool with the query:
"Full_Add LIKE UPPER('%" + searchText + "%')"
This is to search a feature class' 'Full_Add' field for address text. This works fine if people enter something like "12 smith st" and that is the actual address. But if the address is "12/34 smith st" then I still want the search text "12 smith st" to find it.
So I need to:
- Check to see if the first element of the search text starts with a number
- Construct a query that places a wild card after the first element of the search text ONLY if it is a number
0
-
There's probably a way to do it, but wouldn't it be easier to use an Autocomplete Box? That way when your users start typing an address they'll see all the possible matches to what they type. 0 -
We are already using autocomplete, but with large datasets it is not quick enough - users often type in a search term and hit enter long before autocomplete has offered any suggestions. 0 -
PS. In any case, I'd have to make the autocomplete query handle this situation, just the same as the actual search query. :-) 0 -
Not sure if this gets you to what you need, but here's an idea.
1. Assign the first character of the autocomplete search to a new string variable using Left(searchText,1).
2. Use an If statement to test if the first character is a number using the condition yourNewStringVariable LIKE "#".# is a vb wildcard for a single digit 0-9.
0
Please sign in to leave a comment.
Comments
4 comments