Focal Point
Counting the user input to determine where statement

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/8491078142

August 14, 2007, 12:19 PM
serenekk
Counting 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!!


on VMS: OpenVMS AXP V8.2 Prod and TestEnvironment
Webfocus: WebFocus 7.6.1 Prod and TestEnvironment
August 14, 2007, 01:29 PM
mgrackin
I 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';


Thanks!

Mickey

FOCUS/WebFOCUS 1990 - 2011
August 14, 2007, 03:19 PM
serenekk
Thanks 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.


on VMS: OpenVMS AXP V8.2 Prod and TestEnvironment
Webfocus: WebFocus 7.6.1 Prod and TestEnvironment
August 14, 2007, 04:18 PM
mgrackin
ARGLEN was the other method I was thinking of but did not mention it. I'm glad you found it.


Thanks!

Mickey

FOCUS/WebFOCUS 1990 - 2011
August 15, 2007, 11:37 AM
Darin Lee
Sounds 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.


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat