COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: actcognosuser on 23 Dec 2009 08:23:24 AM

Title: how to automatically select the value in value prompt using javascript?
Post by: actcognosuser on 23 Dec 2009 08:23:24 AM
I have only one date in my value prompt.Is there a way that that value gets selected automatically when i run the report?

can anyone share javascript for this functionality?
Title: Re: how to automatically select the value in value prompt using javascript?
Post by: angela on 29 Dec 2009 04:26:24 PM
You can do this without javascript.  Make your query use a filter like:
DateTime Stamp] =
(if (?Date? = 'Yesterday')
then ( _add_days(current_date, -1 ))
else (?Date?))

There's more information at http://it.toolbox.com/wiki/index.php/Default_a_dynamic_date_in_a_prompt_-_no_javascript
Title: Re: how to automatically select the value in value prompt using javascript?
Post by: actcognosuser on 30 Dec 2009 07:48:07 AM
Thanks Angela.But will it work in batch mode.i want to schedule the report to run every day without user intervention.



Title: Re: how to automatically select the value in value prompt using javascript?
Post by: actcognosuser on 31 Dec 2009 08:24:46 AM
Anjela,
           I have'nt used static choices before.Should the use and display value be Yesterday or should the use value be the data item [Date] that i'm prompting on.I looked up the help.But I'm not sure if I put in the right values.

In my query i have only one data item[date] ,parameter is ?NewDate?.

Here is my filter condition:

[Date] =
(if (?NewDate? = 'Yesterday')
then ( _add_days(current_date, -1 ))
else (?Date?))

WHen I enter Yesterday as static value it does not show up in the default selections?

What am i missing??
Title: Re: how to automatically select the value in value prompt using javascript?
Post by: MFGF on 04 Jan 2010 07:58:54 AM
Quote from: actcognosuser on 30 Dec 2009 07:48:07 AM
Thanks Angela.But will it work in batch mode.i want to schedule the report to run every day without user intervention.

Yes - this is a neat solution - I see no reason why it shouldn't work.  Did you try it?

You should be able to get away with just 'Yesterday' as the Use value.

MF.
Title: Re: how to automatically select the value in value prompt using javascript?
Post by: Sreeni P on 04 Jan 2010 12:34:19 PM
Quote from: MFGF on 04 Jan 2010 07:58:54 AM
Yes - this is a neat solution - I see no reason why it shouldn't work.  Did you try it?

You should be able to get away with just 'Yesterday' as the Use value.

MF.


Did u tried MFGF, if not plese provide me the neat solution for this
Title: Re: how to automatically select the value in value prompt using javascript?
Post by: MFGF on 05 Jan 2010 07:27:06 AM
Quote from: srinivas_p on 04 Jan 2010 12:34:19 PM

Did u tried MFGF, if not plese provide me the neat solution for this

I don't quite understand this, sorry.  The neat solution is Angela's - quoted below.

Quote from: angela on 29 Dec 2009 04:26:24 PM
You can do this without javascript.  Make your query use a filter like:
DateTime Stamp] =
(if (?Date? = 'Yesterday')
then ( _add_days(current_date, -1 ))
else (?Date?))

There's more information at http://it.toolbox.com/wiki/index.php/Default_a_dynamic_date_in_a_prompt_-_no_javascript
Title: Re: how to automatically select the value in value prompt using javascript?
Post by: actcognosuser on 05 Jan 2010 07:55:58 AM
Thanks for ur reply.!!

I'm still being prompted to select a value in the prompt for the report to execute.I have Static choice set as
As of Date for use and display value.

In the query I have filter as

[DateOn ]=
(if (?Date1? = 'As of Date')
then ( _add_days(current_date, -1 ))
else (?Date?))

In the value prompt properties what should be the value for default selections?

Title: Re: how to automatically select the value in value prompt using javascript?
Post by: MFGF on 05 Jan 2010 09:13:58 AM
Quote from: actcognosuser on 05 Jan 2010 07:55:58 AM
In the value prompt properties what should be the value for default selections?

In the Default Selections property, try entering Yesterday as the value.

MF.