COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: mohsin2010 on 07 Jan 2011 05:22:30 AM

Title: Use Value Prompt as a Radio Button Group !
Post by: mohsin2010 on 07 Jan 2011 05:22:30 AM
Ok.. it's bit triky as we have to use Javascript. I was thinking like it's on Main page.

Here we go__

1) Create one value prompt name it as 'choice'. The parameter for this is P_choice
2) create two radiobutton group value prompts. the parameters P_Region, P_Country
3) create boolean render variable for Region and Country prompts seperately.
  for Region.... render variable say V_Region
   script would be___
 
Code:

ParamDisplayValue('P_choice')='Region'

  similar for Country
   
Code:

ParamDisplayValue('P_choice')='Country'

4) create an HTML item just beside to Choice prompt
   give the script as
Code:

     <Script>
        function my_onchange()
         {
           SetPromptControl('reprompt')
          }

        document.forms["formWarpRequest"].elements["_oLstChoiceschoice"].onchange = my_onchange
     </Script>


But this code is not working ??? let me know pls HELP :(
Title: Re: Use Value Prompt as a Radio Button Group !
Post by: venkiatmaruthi on 07 Jan 2011 06:47:39 AM
Moshin

This should work. I used the same code in one of my report. What version are you working?
The above script I have sent is for Cognos 8.2. If your is also 8.2 then tell me what is the error?


Thanks.
Venkat.

Title: Re: Use Value Prompt as a Radio Button Group !
Post by: MFGF on 07 Jan 2011 07:22:23 AM
He is using Cognos Express, which is based on Cognos 8.4

MF.
Title: Re: Use Value Prompt as a Radio Button Group !
Post by: mohsin2010 on 09 Jan 2011 10:11:23 PM
thanx venkiatmaruthi ,

                    MFGG is right i m using cognos express 8.4 how do i do the same work on that ? its not working properly over there  ???    
Title: Re: Use Value Prompt as a Radio Button Group !
Post by: venkiatmaruthi on 10 Jan 2011 03:34:49 AM
Moshin,
I am working on 8.2 only.

Not sure it it works.... but try to check this out.

Change the script last line
document.forms["formWarpRequest"].elements["_oLstChoiceschoice"].onchange = my_onchange
with
getFormWarpRequest()._oLstChoicesChoice.onchange=my_onchange;

it should work. In 8.4, the usage of formWarpRquest changed a little.


Thanks.
Title: Re: Use Value Prompt as a Radio Button Group !
Post by: mohsin2010 on 10 Jan 2011 04:11:49 AM
venkiatmaruthi ,

                it is not working .. . i tried it  :'(
Title: Re: Use Value Prompt as a Radio Button Group !
Post by: venkiatmaruthi on 10 Jan 2011 04:51:56 AM
It should work.

are you directly giving the script or have you changed the name of the valueprompt in the script?

getFormWarpRequest()._oLstChoicesChoice.onchange=my_onchange;

here Choice is the name of the Valueprompt where you select either Region or Country.

let me know the error.

Thanks.

Title: Re: Use Value Prompt as a Radio Button Group !
Post by: mohsin2010 on 11 Jan 2011 01:18:27 AM
hi,

from the first step,

1) Create one value prompt name it as 'choice'.

from where can i change the name of the Value Prompt?? ???
Title: Re: Use Value Prompt as a Radio Button Group !
Post by: mohsin2010 on 11 Jan 2011 03:02:40 AM
venkiatmaruthi,

i have named the value prompt but in spite of that it is giving error i have taken picture what i m doing in series and the output also so you can kindly tell me my mistake  :'(

Best Regards,
Syed Mohsin Raza
Title: Re: Use Value Prompt as a Radio Button Group !
Post by: S2000 on 11 Jan 2011 04:08:44 AM
Hi,

If I've read the problem correctly than an alternative solution to all the Javascript could be this.

Set two promts.
The radio button prompt -  P_Choice
The Text Box Prompt  - P_Text

In the filter of the query use the following code
If (P_choice = region) then (region) else (country) = P_Text
Title: Re: Use Value Prompt as a Radio Button Group !
Post by: venkiatmaruthi on 11 Jan 2011 07:17:43 AM
Hi,
I don't know whether you are testing me or you are a fresher to cognos.

Keep HTML item immediate next to the Value prompt.

I don't whether you have given static choices or not. Give static choices as "Region" and "Country".

have to mentioned the variable script as I mentioned earlier?

See my attached screen shots. I hope you are expecting the same functionality.


Thanks.

Title: Re: Use Value Prompt as a Radio Button Group !
Post by: mohsin2010 on 11 Jan 2011 11:39:49 PM
Thanks venkiatmaruthi !
                                 for your such cooperation and i m not checking you dude i m new bie thats why i m getting stuck alot but your screen shots help me out !  :)
   Thanks once again but i want two more things if you dont mind pls.. .

   * like i m getting "Region" name and "Country" name if i want to get those "Country" name and "Region" name  which i have in my table and to generate report according to them so what should i do ??

   * and the second thing is that if i want to summarize my data like i m getting record according to region and i want to summarize data according to region that how much country are there in that region like
(Region America = 2 Countries )

Best Regards,
Syed Mohsin Raza












Title: Re: Use Value Prompt as a Radio Button Group !
Post by: venkiatmaruthi on 12 Jan 2011 04:01:57 AM
Mohsin,

In fact, I am also a newbie to Cognos.... just 3 months old. I am learning the cognos by googlling on net and the help file. you will have Report studio manual. look into it. You can see that.

Sorry to say like this. I am having work.


Thanks.
Venkat.
Title: Re: Use Value Prompt as a Radio Button Group !
Post by: mohsin2010 on 12 Jan 2011 04:26:13 AM
venkiatmaruthi,
 
  yup you are right i m doing that as you told me but i was thinking you would be more professional that my question are in your finger tips and would not waste your time you are 3 months old for cognos and i m just 1 month old and have learned alot from u like people and from the Google !
     the thing you want to make me understand is right but the way you chose is totally Wrong !
   
Best Regard

Syed Mohsin Raza