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

JAVASCRIPT to convert datepormpt values

Started by Gnani, 11 Jul 2011 06:36:56 AM

Previous topic - Next topic

Gnani

Hi,
I need JAVASCRIPT to take the values from date prompt and convert it to 'DD-MON-YYYY' format and pass it to the database for filtering.

Can any help in this regard.

Thanks in adv
Gnani

Lynn

What database requires that? Is it a date datatype or a string datatype in the database?

If it is a string then just convert your date to a string. No need for javascript.

For example, if you have Oracle you could use the TO_CHAR function to convert date to a specific string format. For other databases try the CAST function.

Gnani

Thanks Lynn for the reply,
db is oracle here.
we can't convert since this parameter comes from FM and moreover we took it from Strored procedure.

Thanks
Gnani

Gnani

Datatype for this column in the database is varchar. So we have to conevert.

Thanks,
Gnani

Lynn

Ok, so you have a date prompt control which allows the user to pick a date using the calendar widget. You need to make that a string to pass to the stored procedure. With Oracle I think you'd just need to wrap a TO_CHAR function around your parameter.

I don't have Oracle at my current client but something like this might work for you.

TO_CHAR(?DateParam?,'DD-MON-YYYY')

Gnani

Hi Lynn,
I tried the one which u told but giving below error message:

RQP-DEF-0177 An error occurred while performing operation 'sqlExecute' status='-9'.
UDA-SQL-0107 A general exception has occurred during the operation "execute".
ORA-01858: a non-numeric character was found where a numeric was expected
ORA-06512: at "tablename.colname", line no
ORA-06512: at line 1



Can any one help me out in this regard,

Thanks in adv,
Gnani

Lynn

What is the column that it is complaining about? You said your column is a varchar so it shouldn't be upset that it got non-numerics instead of numerics.

The error indicates that you're trying to provide something other than numbers for a field that is a numeric datatype.

Might be a good idea to figure out how to call the procedure directly (not using Cognos), then you'll better understand how to execute it via Cognos.