Can't preview SQL data for some columns in TI?

Post Reply
User avatar
macsir
MVP
Posts: 785
Joined: Wed May 30, 2012 6:50 am
OLAP Product: TM1
Version: PAL 2.0.9
Excel Version: Office 365
Contact:

Can't preview SQL data for some columns in TI?

Post by macsir »

A strange question, in one TI, we are using ODBC to connect to one Oracle table to get data. For three particular columns, when I try to preview them in TI, they are just empty. (Actually, they have data in that table.) For previewing other columns, they are just fine.
E.g.
If I use SQL for these three particular columns in TI
Select A, B, C from T
In the preview window, they just don't show any value.

If I use SQL for other columns in TI
Select D,E from T
In the preview window, everything is normal and value is there.

If I use SQL to combine these three particular columns with others in TI
Select A, B, C,D, E from T
In the preview window, they just don't show any value also.

What is the possbile root cause here?
In TM1,the answer is always yes though sometimes with a but....
http://tm1sir.blogspot.com.au/
User avatar
Martin Ryan
Site Admin
Posts: 2003
Joined: Sat May 10, 2008 9:08 am
OLAP Product: TM1
Version: 10.1
Excel Version: 2010
Location: Wellington, New Zealand
Contact:

Re: Can't preview SQL data for some columns in TI?

Post by Martin Ryan »

Just guessing here, but it might be that they are ordering by column A and there are 10 null or blank rows in the table.

To test the theory try a query along the lines of select a, b, c from t where a<>'' and a is not null;

Martin
Please do not send technical questions via private message or email. Post them in the forum where you'll probably get a faster reply, and everyone can benefit from the answers.
Jodi Ryan Family Lawyer
Wim Gielis
MVP
Posts: 3241
Joined: Mon Dec 29, 2008 6:26 pm
OLAP Product: TM1, Jedox
Version: PAL 2.1.5
Excel Version: Microsoft 365
Location: Brussels, Belgium
Contact:

Re: Can't preview SQL data for some columns in TI?

Post by Wim Gielis »

Hello

Very recently, I encountered a similar issue. Certain columns (3 out of 7 or so) showed up as blank, with a purple background in the Preview window.
While the other columns where fine. TM1 presented a helpful popup that it could not interpret certain fields (loosely translated). Database is SQL Server.
I haven't spent too much time on it. It *might* be due to certain time functions (Year, Month, Day) that TM1 could not handle:
many (but not all) empty fields in the query deal with functions along these lines.
I solved it by adapting the query and retrieving the actual date. In the Data tab of the process, Subst() functions took out Day, Month, Year.
Best regards,

Wim Gielis

IBM Champion 2024-2025
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
asutcliffe
Regular Participant
Posts: 164
Joined: Tue May 04, 2010 10:49 am
OLAP Product: Cognos TM1
Version: 9.4.1 - 10.1
Excel Version: 2003 and 2007

Re: Can't preview SQL data for some columns in TI?

Post by asutcliffe »

Wim Gielis wrote:Hello

Very recently, I encountered a similar issue. Certain columns (3 out of 7 or so) showed up as blank, with a purple background in the Preview window.
While the other columns where fine. TM1 presented a helpful popup that it could not interpret certain fields (loosely translated). Database is SQL Server.
I haven't spent too much time on it. It *might* be due to certain time functions (Year, Month, Day) that TM1 could not handle:
many (but not all) empty fields in the query deal with functions along these lines.
I solved it by adapting the query and retrieving the actual date. In the Data tab of the process, Subst() functions took out Day, Month, Year.
I encountered something similar a while back too - the columns were coloured in the preview window but I can't recall a popup message of any kind. I'm hazy on the details but I think I put it down to the ODBC driver not handling certain data types but I was able to work around it in a similar fashion to Wim. Are the columns that aren't working a different datatype to those that do work?
jstrygner
MVP
Posts: 195
Joined: Wed Jul 22, 2009 10:35 pm
OLAP Product: TM1
Version: 9.5.2 FP3
Excel Version: 2010

Re: Can't preview SQL data for some columns in TI?

Post by jstrygner »

Just a shot in the dark.
Did you try if checking/unchecking the Unicode checkbox would change anything?
User avatar
macsir
MVP
Posts: 785
Joined: Wed May 30, 2012 6:50 am
OLAP Product: TM1
Version: PAL 2.0.9
Excel Version: Office 365
Contact:

Re: Can't preview SQL data for some columns in TI?

Post by macsir »

Hi, Thanks everyone. You remind me. Those three columns are all date columns in Oracle and they are all with timestamp field. It looks like TM1 doesn't support oracle date data type with timestamp well because another table only with date field can be shown properly. I resolve it by using to_char function to truncate the timestamp for those columns. :D
In TM1,the answer is always yes though sometimes with a but....
http://tm1sir.blogspot.com.au/
User avatar
macsir
MVP
Posts: 785
Joined: Wed May 30, 2012 6:50 am
OLAP Product: TM1
Version: PAL 2.0.9
Excel Version: Office 365
Contact:

Re: Can't preview SQL data for some columns in TI?

Post by macsir »

jstrygner wrote:Just a shot in the dark.
Did you try if checking/unchecking the Unicode checkbox would change anything?
Tried but doesn't help. See my latest post.
In TM1,the answer is always yes though sometimes with a but....
http://tm1sir.blogspot.com.au/
rmackenzie
MVP
Posts: 733
Joined: Wed May 14, 2008 11:06 pm

Re: Can't preview SQL data for some columns in TI?

Post by rmackenzie »

macsir wrote:Hi, Thanks everyone. You remind me. Those three columns are all date columns in Oracle and they are all with timestamp field. It looks like TM1 doesn't support oracle date data type with timestamp well because another table only with date field can be shown properly. I resolve it by using to_char function to truncate the timestamp for those columns. :D
There are data types in all database systems that the combination of TM1 and ODBC driver just can't translate. I'm not sure what the equivalent is for Oracle (GIYF) but this would show you all column types in a SQL server database - use this to be forewarned which columns are going to give you gip in your ODBC-based TI processes:

Code: Select all

SELECT TABLE_NAME, COLUMN_NAME, DATA_TYPE 
FROM [YOUR_DB_NAME_GOES_HERE_SOMETIMES].INFORMATION_SCHEMA.COLUMNS
Optionally, you might also use:

Code: Select all

WHERE DATA_TYPE = 'SOMETHING_THAT_TM1_CANT_HANDLE'
to filter out the troublesome columns.

More information here for SQL Server and something similar for Oracle.
Robin Mackenzie
User avatar
macsir
MVP
Posts: 785
Joined: Wed May 30, 2012 6:50 am
OLAP Product: TM1
Version: PAL 2.0.9
Excel Version: Office 365
Contact:

Re: Can't preview SQL data for some columns in TI?

Post by macsir »

rmackenzie wrote:
macsir wrote:Hi, Thanks everyone. You remind me. Those three columns are all date columns in Oracle and they are all with timestamp field. It looks like TM1 doesn't support oracle date data type with timestamp well because another table only with date field can be shown properly. I resolve it by using to_char function to truncate the timestamp for those columns. :D
There are data types in all database systems that the combination of TM1 and ODBC driver just can't translate. I'm not sure what the equivalent is for Oracle (GIYF) but this would show you all column types in a SQL server database - use this to be forewarned which columns are going to give you gip in your ODBC-based TI processes:

Code: Select all

SELECT TABLE_NAME, COLUMN_NAME, DATA_TYPE 
FROM [YOUR_DB_NAME_GOES_HERE_SOMETIMES].INFORMATION_SCHEMA.COLUMNS
Optionally, you might also use:

Code: Select all

WHERE DATA_TYPE = 'SOMETHING_THAT_TM1_CANT_HANDLE'
to filter out the troublesome columns.

More information here for SQL Server and something similar for Oracle.

Thanks for sharing. Goodo.
In TM1,the answer is always yes though sometimes with a but....
http://tm1sir.blogspot.com.au/
Post Reply