Focal Point
Multiple Value Text Box

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

November 02, 2005, 05:40 PM
DanChek
Multiple Value Text Box
New to focal point. I have a need to allow users to enter multiple values in a text box. This text box would then be included as part of the WHERE clause in my SQL statement for record selection. This is not selecting from a list box, but a user entering multiple values for selection. I have no idea where to begin with this one, any help would be greatly appreciated
November 02, 2005, 07:46 PM
N.Selph
You can have them enter the values, separated by a comma or other punctuation. Then use the ARGLEN function to figure out how many values have been put into the &variable (if they are all the same length). Then use the GETTOK function, to break out the values into separate variables. You will have to put that into a Dialogue Manager loop, controlled by the number you have found using ARGLEN.


Assume the textbox value is &VALUEIN, and it the user has put in something like 123456,456456,789789
 
-SET &VALUEINX=&VALUEIN || ',';
-SET &NUMIN=ARGLEN(100,&VALUEINX,'I3')/7;
-SET &N=1;
-REPEAT ENDLOOP &NUMIN TIMES;
-SET &VALUE.&N=GETTOK(&VALUEINX,100,&N,',',6,'A6');
-SET &N=&N + 1;
-ENDLOOP

You should get &VALUE1 = 123456, &VALUE2=456456, &VALUE3=789789

This message has been edited. Last edited by: <Maryellen>,


(Prod: WebFOCUS 7.7.03: Win 2008 & AIX hub/Servlet Mode; sub: AS/400 JDE; mostly Self Serve; DBs: Oracle, JDE, SQLServer; various output formats)
November 04, 2005, 01:44 PM
DanChek
Still having problems. I entered the following code:

-* TEST CODE
-SET &VALUEINX=&BUSUNIT.Enter Business Unit:. || ',';
-SET &NUMIN=ARGLEN(100,&VALUEINX,'I3') / 7;
-SET &N=1;
-REPEAT ENDLOOP &NUMIN TIMES;
-SET &VALUE.&N=GETTOK(&VALUEINX,100,&N,',',12,'A12');
-SET &N=&N + 1;
-ENDLOOP
-? &
-* TEST CODE

When I run it, I get the following results:

-SET &VALUEINX=123456789012,111111111111 || ',';
-SET &NUMIN=ARGLEN(100,123456789012,111111111111,,'I3') / 7;
-SET &N=1;
-REPEAT ENDLOOP 3 TIMES;
-SET &VALUE1=GETTOK(123456789012,111111111111,,100,1,',',12,'A12');
-SET &N=1 + 1;
-REPEAT ENDLOOP 3 TIMES;
-SET &VALUE2=GETTOK(123456789012,111111111111,,100,2,',',12,'A12');
-SET &N=2 + 1;
-REPEAT ENDLOOP 3 TIMES;
-SET &VALUE3=GETTOK(123456789012,111111111111,,100,3,',',12,'A12');
-SET &N=3 + 1;
-ENDLOOP

The number of values being entered is 2 and the code is producing 3. What is the purpose of the divide by 7. My values are 12 characters long and can contain embedded spaces as well. I must be missing something. Help. Thanks
November 04, 2005, 07:43 PM
N.Selph
In my example, my values were six characters long, and one character separator, so I divided by 7. You probably want to divide by 13. You want to find out how many values got input into the &VALUEINX, so you know how many times the loop has to go around.
November 08, 2005, 05:16 PM
DanChek
Got it working. Thanks for your help..