COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: jason.haskins on 12 Apr 2021 10:02:15 AM

Title: Double Quotes for Date Field
Post by: jason.haskins on 12 Apr 2021 10:02:15 AM
I have the need to create a .CSV file to send to a vendor which has a requirement for the data to be enclosed in double quotes.  I have been able to get this to work for all the fields within the file using the '""+[filename]+''' syntax.  However, on a field that contains a date (MM/DD/YYYY), it will not validate.  Is there a way that I can enter this to validate it and produce "MM/DD/YYYY" in the field?
Title: Re: Double Quotes for Date Field
Post by: MFGF on 12 Apr 2021 11:35:37 AM
Quote from: jason.haskins on 12 Apr 2021 10:02:15 AM
I have the need to create a .CSV file to send to a vendor which has a requirement for the data to be enclosed in double quotes.  I have been able to get this to work for all the fields within the file using the '""+[filename]+''' syntax.  However, on a field that contains a date (MM/DD/YYYY), it will not validate.  Is there a way that I can enter this to validate it and produce "MM/DD/YYYY" in the field?

Hi,

Assuming the date is currently defined as a Date datatype item in your report, you'll probably need to cast the date to a character string. To get the format you need, you may end up having to extract each part of the date (month, day and year) using the Extract() function then cast these integer results to character strings, adding the '/' delimiters.

Cheers!

MF.