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

[Solved] Date Format Problem

Started by johnpenna, 12 Aug 2005 08:46:05 AM

Previous topic - Next topic

johnpenna

Hi I have an irritating problem .I cannot force the date format in the date prompt to display in the format dd/mm/yyyy

It displays 07-Jan-04.

I have tried The data format properties of the object. i.e Displaying the Format, trying to force the pattern to display months 2 digits

using dd/mm/yyyy in the pattern...The Parameters below being the data prompts...

The expression saysÃ,  Ã, Dateprompt 1 = From Date "Database1.shareholderview.tradedate<?Parameter2?"

Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã, Dateprompt 2= To Date "Database1.shareholderview.tradedate>?Parameter3?"

There is some suggestion of changing the server date.????

orÃ,  changing the raw SQL to something like this below.

to_date([CDATE],'mm/dd/yyyy') in_rangeÃ,  ?DateRange?


Any help or this irritating problem.
Cognos sais "The issue lies in the fact that a prompt value for a date is actually considered a string rather than a date.Ã,  Therefore you need to cast the parameter to a date in a data item and then format that column."


John


Darek

If I am not mistaken, the internal value of a date prompt will be always YYYY-MM-DD to keep it in compliance with SQL9x standard. So there is a separate function for drawing on the user's screen, called CDatePicker_drawDate()

//render the date in the proper format
function CDatePicker_drawDate()
{
   var sFormatDate = "";
   if (this.m_dDate)
   {
      //update the edit box
      sFormatDate = getFormatDate (this.m_dDate, this.m_iType, this.m_sInputOrder);
   }
   if (this.m_bInline == 0 )
   {
      this.m_oEditBox.value = sFormatDate;
   }
}

Potentially you could overwrite it, or you could overwrite the getFormatDate function, which really performs the formatting.

Or instead of modifying Cognos code, you could inject a JavaScript snippet into your prompt page, which would attach itself to blur event and reformat date after CRN.

CRiNge

You obviously have tried to create a calculation to format this dataitem in Framework Manager???

johnpenna

With help from cognos I have solved the problem. Just a case of using the datecast function in report studio.MAking sure I have selected the DB2 vendor option in the expression builder.

I used data items instead of the parameter.This allowed me to format easily without any coding.

Thanks for the help guys

Darek

I've misunderstood. I've thought you need it in the prompt box itself ...