Quando omni flunkus, mortati. Die dulci fruere.

| Subscribe via RSS

Showing posts with label prompts. Show all posts
Showing posts with label prompts. Show all posts

Wednesday, August 26, 2009

Remove the Dotted Line/Title(parameter) in Cognos 8.4

| 0 comments

Need to remove the dotted line and title of a value prompt? Create an HTML Item in your report and fill it with the following Javascript:



<script>
var f = getFormWarpRequest();
var prompt = f._oLstChoicesX;
prompt.remove(1);
prompt.remove(0);
prompt.removeAttribute("hasLabel");
</script>

Where X is the name of the prompt specified in the properties. This tip works with Cognos 8.4. There are other Javascript methods for earlier versions.





Wednesday, February 11, 2009

Prompt date formats

| 0 comments

In Cognos, date formats used in prompts are controlled by the locale settings. Although the locales each have their own format for dates you can change the format of the prompt date for your desired locale.

In the directory ...\cognos\c8\webcontent\prompting\res are two files called promptLocale_.js and promptLocale_.xml.

In these files you can see the date formats used for each locale. For example, if you want to use the en-us locale within Cognos 8, and you prefer a different date format for the prompt you can easily edit the promptLocale_en-us.js and promptLocale_en-us.xml files to change the medium date format. Let's say that you prefer to use the date format of yyyy-MM-dd, you'll just need to do the following:

In the promptLocale_en-us.js file,
  • Change the value for g_mediumFormat to this: yyyy-MM-dd h:mm:ss a
  • Change the value for g_mediumFormatDateOrder to this: YMD
  • Change the value for g_monthFormatMedium to this: MM
  • Change the value for g_dayFormatMedium to this: dd
In the promptLocale_en-us.xml file, change the following 4 properties to reflect the changes below:
  • yyyy-MM-dd h:mm:ss a
  • YMD
  • MM
  • dd
Always make sure you backup these files before any changes are made.

Friday, January 23, 2009

Set default "from date" in a date range prompt

| 1 comments

I discovered recently that you can't set the "default" of any Cognos prompts to a dynamic (non-static) value.

Let me explain: In my example, within Report Studio, I needed to change a date range prompt. I needed the "from date" to default to the beginning of the current year (i.e. Jan. 1, 2009), and the "to date" to default to the current date (today's date).

The best (non-Javascript) method of handling this as I discovered, is to create a radio-button prompt with the static choices of "From Start of Year" and "Select From Date". Next, I set these to values of 1 and 0 respectively. Finally, in the filter, I used the following logic:

(?DateType?=1 AND [MyDate] > _make_timestamp(extract('year',currentdate),01,01))

OR

(?DateType?=0 AND [MyDate] > ?FromDate?)