COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: hsu29 on 25 May 2007 05:35:40 AM

Title: RS - Set a value into a Value Prompt
Post by: hsu29 on 25 May 2007 05:35:40 AM
Tool: Report Studio. Cognos 8.2

Hi

I have a "Value Prompt" with the collection of recent years: 2004, 2005, 2006, 2007.
and want to assign the current year as the default value for that object.


How could I do that?
If it's via Javascript code, Where could I find the list of objects\methods that we can use within a report?

Thanks a lot
Title: Re: RS - Set a value into a Value Prompt
Post by: goose on 25 May 2007 09:00:43 AM
You can use this javascript

var Cognos = {
  Dropdown: '_oLstChoices',
  Textbox:  '_textEditBox'
}

var Form = {
  Control: function (name) {
    return document.getElementById(Cognos.Textbox + name)
      ||   document.getElementById(Cognos.Dropdown + name)
      ||   document.getElementById(name)
      ||   false;
  }
}



Example usage (You must name the control in Report Studio, here 'year' is the name):

alert(Form.Control('year').value;