If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

Java script to Limit Number of Listbox Value Prompt Selection

Started by Starfish2201, 03 Jun 2013 02:35:24 PM

Previous topic - Next topic

Starfish2201

Hi Gurus,

I need a Java script to Limit Number of Listbox Prompt Selection. I looked for the same on different forums, but most of them not working or not exactly what I am looking for.

I have multiple Value prompts in the prompt page, but in one Value prompt, I want to limit the number of values chosen to 10.

THanks a lot in advance, your help is much appreciated !!!

calson33

Why limit them in javascript and not in the prompt query?

Starfish2201

Thanks for your response calson33 !!!

Are you saying to change the "Rows Per Page" to 10? Or you are meaning something else here?

Thanks again!

calson33

Something else -

Give us an example of the prompt you want to limit - What kind of data does it have (e.g. Years, or dates, etc.) and how do you want to limit it (e.g. Next 5 and last 5 years).

That way we will all be talking about the same thing.

MMcBride

Starfish2201 do you mean Number of Displayed values limited to 10 or number of 'selected' items to 10 - so you can display 20 but the user could only select 10?

If you want to limit the number of displayed you simply go to the Query that you are using to populate the Prompt and filter the data - say "top 10" or something like that to limit the number of values returned by the prompt query.

If you want to Display all but only allow 10 selections - I have never seen that done before so I am not even sure where to begin.


Lynn

How about using the ParamCount function instead of Java Script? You can create a page that renders only when the parameters selected is > 10 which shows a message indicating they exceeded the allowed selections. You could include a link that drills to the same report so they can try again. You'd need another variable so the main report page only renders when the parameter count is <= 10.

Starfish2201

Thanks a lot Lynn, MMcBride, Calson33 !!!

Calson33, the prompt has ProductTypes, lets say P1, P2, P3 till P20. User should be able to see all 20, but can run the report with only any 10.

MMcBride, to answer your question, I want to display all, but allow only 10 to get selected in the listbox value prompt.

Lynn, yes that's a good idea, but the user would have to go with 3-4 extra clicks, e.g. user selects 11 values, then hits FINISH, then sees the "Error Page", then comes back to prompt page again to chose any 10.

I thought of using Conditional Block, where I will put the FINISH button in the conditional block and will show the Finish button only when ParamCount('p_Param') is less than 11, but in that case I have to submite the prompt page to calculate ParamCount.

Please let me know if I can follow any other way.

Again thanks tons for all your responses.

Starfish2201

Hello,

I found the JAVA script to limit the prompt selection and its working fine.

Thanks a lot everyone for your responses, you guys are awesome !!! :)

bala12345

Hi,

I have got same requirement,can you please send the code that you found for this requirement to my email (xxxxxxxxxxxxxxxxxx@gmail.com).I am fighting with this issue from 2 days.Please help me.

Thanks,
Bala

Moderator edit: Please don't post your email addresses up, folks - it simply invites unwanted spam. Anything for public consumption can be put up in a thread and the Personal Message system can be used for anything private. Thanks. MF