Focal Point
<SOLVED>Multiple select for list box.

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

March 25, 2014, 10:24 AM
Rakesh Boddu
<SOLVED>Multiple select for list box.
Hi ,

I have sql report(Oracle database) which has prompt in it.I created list box in html composer from my prompt with multiple select option enable.If i select single value in list box i am able to run my report but when i select multiple values i am getting an error.

Here is the sample prompt in where clause.

Where VP.ID IN (&ID)

When i select mulitple values i was not able to replace OR with ,

I need to know how webfocus will process the prompts and i need to print and check how the value submitted in prompt is effecting my sql code dynamically.

Can you guys help me to figure out how to acheive this.It would be great help for me.

Thanks,
Rakesh

This message has been edited. Last edited by: Rakesh Boddu,


WebFOCUS 8.0.03
Windows, All Outputs
March 25, 2014, 10:32 AM
MattC
You can do the following.

The variable being passed from the HTML, you can get the length first, then use STRREP to replace the OR with a ,

Then I like to truncate to remove all the spaces.

 -SET &WhereVPLength        = &VP.LENGTH;
-SET &WhereVPAdjust        = IF &VP CONTAINS ' OR ' THEN STRREP (&VP.LENGTH, &VP, 4, ' OR ', 1, ',', &VP.LENGTH, 'A&WhereVPLength.EVAL') ELSE &VP ;
-SET &WhereVPTru           = TRUNCATE(&WhereVPAdjust); 

This message has been edited. Last edited by: MattC,


WebFOCUS 8.1.05
March 25, 2014, 11:00 AM
j.gross
quote:
STRREP (&VP.LENGTH, &VP, 3, ' OR ', 1, ',', &VP.LENGTH, 'A&WhereVPLength.EVAL')


Oops - the length of
' OR '
is 4, not 3.
March 25, 2014, 11:03 AM
MattC
Oops! - Thanks!


WebFOCUS 8.1.05
March 25, 2014, 02:04 PM
j.gross
If you know the values are quoted character strings,
 ..., 6,(''' OR '''), 3,(''','''), ...

is better.
March 26, 2014, 08:18 AM
Rakesh Boddu
Thanks Guys for your inputs.It worked as expected.

Especially MattC you rock man. Good One


WebFOCUS 8.0.03
Windows, All Outputs