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

Recent posts

#11
Reporting / Re: Date format in CSV
Last post by dougp - 26 Jan 2026 06:42:47 PM
QuoteYou are not answering the questions.

That is correct.  Still unanswered...

QuoteNot working for CSV?  Or not working for Excel?  Excel doesn't understand CSV files.  You might try looking at the result in a text editor.

Basically, if you're using Excel to open a CSV file, you're doing it wrong.
And if the requirement is to display data in Excel, use the Excel output format, not CSV.
#12
Framework Manager / Re: Adding new column on exist...
Last post by psrpsrpsr - 26 Jan 2026 03:11:25 PM
This approach worked for me!
1. Click on Query Subject
2. Tools > Update Object

My table was indeed select * from [blah], so no concerns from me on potentially old fields being removed via the Update.

Thanks - kind of funny to find a 15 year old thread that solves my problem in 2026 :)

Quote from: bloggerman on 19 Aug 2010 03:35:38 PMI believe there is another way to it..The one mentioned above should work as well....Click on the Query Subject....Under Tools tab click the "Update Object" option and that should update the Query Subject with latest metadata information from the database. Try it out and let me know if it works.

Quote from: cognostechie on 19 Aug 2010 03:41:33 PMYes, Tools/Update Object is the right way to do it. However, keep in mind that by doing this, if any column has been deleted from the Table, it will also be deleted from the Query Subject
#13
Reporting / Re: Date format in CSV
Last post by bus_pass_man - 23 Jan 2026 05:37:55 PM
You are not answering the questions.  I don't know if that is because you don't understand them or not.  Your responses lack sufficient context. Please do try to answer the questions.
#14
Reporting / Re: Date format in CSV
Last post by Good Friend - 23 Jan 2026 03:25:54 PM
I'm using the current date and converting it to a varchar format. It displays correctly as YYYY-MM-DD in HTML and Excel outputs. However, when exporting to CSV, the format changes to YYYY/MM/DD, regardless of the adjustments made in the report expression.

Users rely on the CSV output as a source file for downstream imports, so they need the date to be consistently formatted without requiring any manual changes after download.
#15
Reporting / Re: Date format in CSV
Last post by bus_pass_man - 23 Jan 2026 01:25:11 PM
1.  What is the data type of the column which is the source of your data?
2.  When you test that column, what does the data look like?
3.  If you use the cast function to cast the column to date what does the data look like?
4.  Can you answer Doug's question.  Are you using a text editor to look at the CSV output?
 
#16
Reporting / Re: Date format in CSV
Last post by Good Friend - 23 Jan 2026 08:25:13 AM
Thanks Doug for responding on this and this is a CSV issue. I just ran below code and the CSV output is generating the Date format as 01/23/2026 instead of 2026-01-23. Users are expecting YYYY-MM-DD format in csv. Please let me know if there is any workaround this. Thanks.

Code:

cast(_year (current_date), varchar(4)) || '-' ||
substring('00' || cast(_month(current_date), varchar(2)), 1 + char_length(cast(_month(current_date), varchar(2))), 2) || '-' ||
substring('00' || cast(_day  (current_date), varchar(2)), 1 + char_length(cast(_day  (current_date), varchar(2))), 2)
#17
Reporting / Re: Date format in CSV
Last post by dougp - 16 Jan 2026 01:51:15 PM
What's with the = and the quotes?  Are those needed in your CSV?

Quotenot working as expected for CSV
Not working for CSV?  Or not working for Excel?  Excel doesn't understand CSV files.  You might try looking at the result in a text editor.


Here's what I get using database-agnostic Cognos functions and operators:
                  cast(_year (current_date), varchar(4)) || '-' ||
substring('00' || cast(_month(current_date), varchar(2)), 1 + char_length(cast(_month(current_date), varchar(2))), 2) || '-' ||
substring('00' || cast(_day  (current_date), varchar(2)), 1 + char_length(cast(_day  (current_date), varchar(2))), 2)
#18
Reporting / Re: Date format in CSV
Last post by Good Friend - 15 Jan 2026 02:07:25 PM
Thanks again for spending time on this. Tried your logic but somehow it is not working as expected for CSV. I got a workaround for CSV with the below logic but when you export it to CSV you will have something like =" 2026-01-15 " and got to format it little bit to show it as 2026-01-15. Below is the Code

Code:
'=" ' + cast(extract(year, current_date), varchar(4)) + '-' +
(if (extract(month, current_date) < 10) then ('0') else ('')) + cast(extract(month, current_date), varchar(2)) + '-' +
(if (extract(day, current_date) < 10) then ('0') else ('')) + cast(extract(day, current_date), varchar(2)) + ' "'
#19
Reporting / Re: Date format in CSV
Last post by sjohnson - 15 Jan 2026 07:49:50 AM
Good Friend,
Sorry the code didn't work for you. 2041 is the sum of the year, month, and day. Any chance your code looks something like this?
_year(current_date)
+
_month(current_date)
+
_day(current_date)

If the date separators ('-') aren't included in the Data item expression then the result is evaluated mathematically since the '+' operator is being used for concatenation and all the parts are numeric.

If you replace '+' with '||' in the above code
_year(current_date)
||
_month(current_date)
||
_day(current_date)
then you should get '2026115'.

If you include the date separators in the original code above
_year(current_date)
+ '-' +
_month(current_date)
+ '-' +
_day(current_date)
then you should get '2026-1-15'.

Combining both suggested changes yields
_year(current_date)
|| '-' ||
_month(current_date)
|| '-' ||
_day(current_date)
which will also return '2026-1-15'.

Having said all that, I just noticed that the code I suggested will only return a single digit for month for any month before October and you requested MM. I have another, inelegant, solution for that. The code looks at the month value and concatenates a '0' if it is less than 10.
With date separators:
_year(current_date)
|| '-' ||
if (_month(current_date) < 10)
then ('0')
else ('')
||
_month(current_date)
|| '-' ||
_day(current_date)
returns 2026-01-15

Without date separators:
_year(current_date)
||
if (_month(current_date) < 10)
then (0)
else (null)
||
_month(current_date)
||
_day(current_date)
returns 20260115

To summarize
  • Both || and + can be used for concatenation. Using the + operator to concatenate can result in unexpected addition when all values are numeric.
  • Data formatting for csv/Excel Data can be a bit of a pain in my experience.

#20
Reporting / Re: Date format in CSV
Last post by Good Friend - 14 Jan 2026 03:18:45 PM
Thanks Johnson for your response. Tried your code and it isnt working as expected. I'm using current_Date as date and backend is SQL server and the result is coming as 2041.