Focal Point
[SOLVED] comma separated multiple values in an EditBox

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

September 24, 2014, 01:27 PM
ccer
[SOLVED] comma separated multiple values in an EditBox
I have an HTML launch page,
one of the Fields in the launch page is ID_Number.
There are too many IDs to display in the Listbox. So, users can run a report on a particular ID number or multiple IDs by entering them in the EditBox.

I have a Filter in the report for the ID_Number column.
What logical relation, compare type and Compare Value should I enter to make it work?

Thanks,

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


WebFOCUS 8.08
Windows, All Outputs
September 24, 2014, 06:37 PM
Doug
How many ID_Numbers would the user need to enter? What is "Too Many to enter"?
September 25, 2014, 09:48 AM
ccer
Hi Doug,
It could vary from 1 to as many as the user wants. It probably will not be more than 10 but it depends on the user. There are about 10,000 IDs and I don't want a listbox of 10,000 IDs.
For example: I want the user to be enter the IDs in the text box in this format:

ID_1, ID_2, ID3 ..


WebFOCUS 8.08
Windows, All Outputs
September 25, 2014, 06:34 PM
Waz
If they are just numbers, then you could use WHERE ID_Number IN (&ID_Number).

You will have to add checked to make sure this doesn't cause the fex to error though.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

September 26, 2014, 09:44 AM
ccer
They are characters.
I want something like this:
WHERE ID_NUMBER EQ 'ID_01', OR 'ID_02' OR 'ID_03'...


WebFOCUS 8.08
Windows, All Outputs
September 26, 2014, 10:17 AM
MartinY
You can do it as Waz mentioned even if it's characters. You don't need to test with OR using that technic.


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
September 26, 2014, 10:46 AM
BarryS
Hi

There are a number of ways that you can do this but it will require some javaScript code. I built a IntelliSence like set of controls that can allow the user to search ids and then save the selection and do another search and save the selection. I have a presentation that I could share with you. Open a tech support case and ask for Barry.

Thanks Barry


WebFOCUS 8103, Windows, App Studio
September 26, 2014, 11:01 AM
Mighty Max
Going off of what Waz said. Need to have an agreement with the users on how many items they can enter and the format.
  
-SET &ECHO = 'ALL';

-DEFAULT &INPUT = 'England , FRANCE , W germany, italy'
-DEFAULTH &ITEM = ''
-DEFAULTH &ITEM_LIST = ''


-REPEAT LP_LIST FOR &N FROM 1 TO 10;
-SET &ITEM = GETTOK('&INPUT.EVAL', &INPUT.LENGTH, &N, ',', 10, 'A&INPUT.LENGTH');
-SET &ITEM = UPCASE(&ITEM.LENGTH, '&ITEM.EVAL', 'A&ITEM.LENGTH');
-SET &ITEM = TRUNCATE(&ITEM);
-SET &ITEM = TRIM('B', '&ITEM.EVAL', &ITEM.LENGTH, ' ', 1, 'A&ITEM.LENGTH');
-IF &ITEM EQ '' THEN GOTO LP_LIST ;
 
-SET &ITEM_LIST = IF &N EQ 1 THEN '''' || &ITEM ||  '''' ELSE &ITEM_LIST || ',' || '''' || &ITEM ||  ''''  ;

-LP_LIST

-TYPE ITEM_LIST = &ITEM_LIST

TABLE FILE CAR
SUM
   DEALER_COST
   RETAIL_COST

BY COUNTRY
BY CAR
BY MODEL
WHERE COUNTRY IN (&ITEM_LIST)
END
-RUN



WebFOCUS 8.1.05M Unix Self-Service/MRE/Report Caster - Outputs Excel, PDF, HTML, Flat Files
September 28, 2014, 11:10 AM
Danny-SRL
Assuming that the input is alpha, one can use a bunch of functions to replace the comma with a quote-comma-quote sequence. There shouldn't be any spaces around the commas in the input unless the value has a leading or trailing space!
  
-* File ccer01.fex
-SET &ECHO = 'ALL';
-*
-DEFAULT &INPUT = 'ENGLAND,FRANCE,W GERMANY,ITALY'
-SET &ILEN=&INPUT.LENGTH;
-SET &STRLEN=ARGLEN(&ILEN,STRIP(&ILEN, &INPUT, ',', 'A&ILEN.EVAL'), 'I3');
-SET &CC=&ILEN - &STRLEN;
-SET &QLEN=&STRLEN + 3 * &CC;
-SET &ITEM_LIST = STRREP(&ILEN, &INPUT, 1, ',', 3, ''',''', &QLEN, 'A&QLEN.EVAL');
-TYPE ITEM_LIST = &ITEM_LIST
-*
TABLE FILE CAR
SUM
   DEALER_COST
   RETAIL_COST
BY COUNTRY
BY CAR
WHERE COUNTRY IN ('&ITEM_LIST');
END



Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

September 29, 2014, 09:31 AM
ccer
Thank you!
This issue is resolved.
I was able to speak with Barry and get his solution by using Javascript.
It wasn't exactly what I was looking for but it works.


WebFOCUS 8.08
Windows, All Outputs
September 29, 2014, 05:21 PM
Waz
Please edit your first post in this thread and add [SOLVED] or [CLOSED] to the title


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

October 01, 2014, 06:00 AM
Dave
Don't do that !

I've done similar things before...
...and found out WebFocus had a out-of-the-box solution.

Only thing you have to do is make the input type "Text area" ( not an "Text box" ).

This will allow you to set the property "Multiple" to "Multiple".
And you can set the property "Multiple: Add quotes" to "Yes".

This will make the HTML convert the entered values to exactly what you want.

A,B,C -> "A" OR "B" OR "C"

and you can even use line-feeds or semicolon as seperator.


....and yes, I wish I knew this before I started adding quotes myself.

....and why doesn't type "input box" support this?



G'luck.


_____________________
WF: 8.0.0.9 > going 8.2.0.5
October 01, 2014, 06:37 AM
Rifaz
Good One


-Rifaz

WebFOCUS 7.7.x and 8.x
October 01, 2014, 09:58 AM
ccer
Thanks Dave! I will give it a try.


WebFOCUS 8.08
Windows, All Outputs
October 07, 2014, 03:28 PM
nsk110483
quote:
Originally posted by Dave:
Don't do that !

I've done similar things before...
...and found out WebFocus had a out-of-the-box solution.

Only thing you have to do is make the input type "Text area" ( not an "Text box" ).

This will allow you to set the property "Multiple" to "Multiple".
And you can set the property "Multiple: Add quotes" to "Yes".

This will make the HTML convert the entered values to exactly what you want.

A,B,C -> "A" OR "B" OR "C"

and you can even use line-feeds or semicolon as seperator.


....and yes, I wish I knew this before I started adding quotes myself.

....and why doesn't type "input box" support this?



G'luck.


I really had to use javascript to process input content in Textarea, As my request was to put in an address field which can have commas in it.


In Focus since 2008
WebFOCUS 8.2.0.1
Windows 7 - IE,Chrome,Firefox
Excel, PDF, HTML, AHTML, XML
JavaScript, jQuery, D3.js, Highcharts
October 08, 2014, 03:16 AM
Dave
Roll Eyes

Yes... then you're doomed :-)

unfortunatly you can not indicate what seperator to use.

Although when entering
This is an address, with a comma;
And this is another one, with comma;

actually results in:
'This is an address,with a comma' OR 'And this is another one,with comma'


G'luck


_____________________
WF: 8.0.0.9 > going 8.2.0.5