August 14, 2007, 12:19 PM
serenekkCounting the user input to determine where statement
Hi All,
I have a fex that I need to count user's input and determine where statement that uses EQ or LIKE etc. For example, If user enters ICECREAM, then this is the whole thing, if just I, then where statement will be something like this:
WHERE PRODUCT LIKE 'I%'
instead of
WHERE PRODUCT EQ 'ICECREAM' etc.
How do I get to this to determine the user only gives the first initial and not the whole thing?
Thanks so much in advance!!
August 14, 2007, 01:29 PM
mgrackinI assume all you need to do is count the number of characters in the value supplied by the user. You can do this a couple of ways. Using the .LENGTH operator on a Dialogue Manager variable is probably what you want to use.
-IF (&VALUE.LENGTH LT 8) THEN 'USE LIKE' ELSE 'USE EQUAL';
August 14, 2007, 03:19 PM
serenekkThanks so much. I found ARGLEN function which was better. I tried with the .length first as well and it was good too.
Again thanks Mikey.
August 14, 2007, 04:18 PM
mgrackinARGLEN was the other method I was thinking of but did not mention it. I'm glad you found it.
August 15, 2007, 11:37 AM
Darin LeeSounds like you found what you needed, but here's an idea we use that allows the user the always get what they're looking for. Anytime we use text input boxes as in your example, we also include a radio button set that has the options of "Begins with","Contains"," and "Equals exactly." This then is also a parameter which is passed to determine the WHERE statement.
Begins with would be WHERE FLDNM LIKE 'I%'
Contains would be WHERE FLDNM CONTAINS 'ICE'
Equals exactly would be WHERE FLDNM EQ 'ICE CREAM'
Dialogue Manager commands build the WHERE using the radio button parameter and the text box parameter. And we get the most efficient selection statement passed to the DBMS.