Select to view content in your preferred language

Enhanced Search Widget Wildcard Search Syntax

1423
13
Jump to solution
11-07-2012 05:20 AM
MichaelVolz
Esteemed Contributor
To All Enhanced Search Widget Users:

I have a search with an ID field of 8 characters where I would like to just have a wildcard for the last character with a requirement of at least 7 characters before the Search is enabled.  I would just like to change the config file and avoid modifying the uncompiled action script code, if that is possible.

This is the search I have for matching the end of the user input value, but it allows too many results to be found.
<value prompt="Example: M1234567" isvaluerequired="true">upper(ID) LIKE upper('[value]%')

I have values of say M1234561, M1234562, M1234563, M1234564, M1234565 and M1234559, M1239999, M1230000.

I want to just get back the first 5 values (M1234561, M1234562, M1234563, M1234564, M1234565) if I enter M123456.  I would not want the user to be able to search for M123 which would retrieve all of these records.  The feature class has thousands of entries so I am currently getting thousands of returns if I am able to perform a search with less than 7 characters.
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus
Michael,

   OK, what you need to look into is SQL syntax. The % symbol is a wildcard that allows any number of characters to be wild. If you want to limit it to one character than you use _ which says "one wild character"

ArcMap Help documentation:

% means that anything is  acceptable in its place: one character, a hundred characters, or no character.  Alternatively, if you want to search with a wildcard that represents one  character, use _.



<value prompt="Example: M1234567" isvaluerequired="true">upper(ID) LIKE upper('[value]_')

View solution in original post

0 Kudos
13 Replies
RobertScheitlin__GISP
MVP Emeritus
Michael,

   OK, what you need to look into is SQL syntax. The % symbol is a wildcard that allows any number of characters to be wild. If you want to limit it to one character than you use _ which says "one wild character"

ArcMap Help documentation:

% means that anything is  acceptable in its place: one character, a hundred characters, or no character.  Alternatively, if you want to search with a wildcard that represents one  character, use _.



<value prompt="Example: M1234567" isvaluerequired="true">upper(ID) LIKE upper('[value]_')
0 Kudos
SladeBridges
Emerging Contributor
this doesn't seem to work on 3.1
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Slade,

   That is standard SQL language that is not GIS specific and definitely not widget version specific. It should work in 3.1. What does your expression look like?
0 Kudos
SladeBridges
Emerging Contributor
<value prompt="Example: NAME">upper(NAME) = upper ('[value]')</value>
0 Kudos
SladeBridges
Emerging Contributor
Slade,

   That is standard SQL language that is not GIS specific and definitely not widget version specific. It should work in 3.1. What does your expression look like?


Robert,
I simply want a wildcard, i realize this post is actually for limiting the returns after the initial user input.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Slade,

   OK, I am not sure what your expression has to do with this forum post then. You do not seem to have any wild card or a like in the expression at all...
0 Kudos
SladeBridges
Emerging Contributor
Slade,

   OK, I am not sure what your expression has to do with this forum post then. You do not seem to have any wild card or a like in the expression at all...


yes, as i indicated, i want to be able to use a wildcard in my search. as you noted, i do not have one. when i use the syntax above my search widget fails.
0 Kudos
SladeBridges
Emerging Contributor
when i do this:  <value prompt="Example: NAME">upper(NAME) =  LIKE upper ('%[value]%')</value>, i get the fault code 400
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Slade,

   OK, from your first post it sounded like you had already tried to add a wild card to your expression and it was not working.

Here is what you are looking for.

<value prompt="Example: NAME">upper(NAME) LIKE upper('[value]%')</value>                         
0 Kudos