COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: Cognos Peasent on 04 Dec 2015 08:23:04 AM

Title: Easy One - Syntax Error near '=' (UDA-qos-0006 UDA-sql-0358)
Post by: Cognos Peasent on 04 Dec 2015 08:23:04 AM
Hey I've got a report working on fiscal years and I have a working prototype of the expression definition here

case
when [Month] in (01,02)
then [Year]-1
when [Month] = 03
then
case
when [Day] < 26
then [Year]-1
else [Year]
end
else [Year]
end


Now I'm trying to replicate this code and put it into my query which looks like the following

case
when extract(month,current_date) in (01,02)
then ([Relational Layer].[Gaap Reporting Period].[Gaap Reporting Year] = extract(year,current_date)-1)
when extract(month,current_date) = 03
then
case
when extract(day,current_date) < 26
then  ([Relational Layer].[Gaap Reporting Period].[Gaap Reporting Year] = extract(year,current_date)-1)
else ([Relational Layer].[Gaap Reporting Period].[Gaap Reporting Year] = extract(year,current_date))
end
else ([Relational Layer].[Gaap Reporting Period].[Gaap Reporting Year] = extract(year,current_date))
end


Yet I get an error that says

UDA-QOS-0006 Error
UDA-SQL-0358 Line 233: Syntax error near "=".

Any ideas guys? I read the IBM document but it didn't help

http://www-01.ibm.com/support/docview.wss?uid=swg21420771

Thanks!
Title: Re: Easy One - Syntax Error near '=' (UDA-qos-0006 UDA-sql-0358)
Post by: Michael75 on 04 Dec 2015 09:26:55 AM
Try this:

(
extract(month,current_date) in (01,02)
and [Relational Layer].[Gaap Reporting Period].[Gaap Reporting Year] = extract(year,current_date)-1
)
OR
(
extract(month,current_date) = 03
and /*your logic for day <26 or >= 26*/
)
OR
(
[Relational Layer].[Gaap Reporting Period].[Gaap Reporting Year] = extract(year,current_date)
)


You'll find a lot of posts on Cognoise, many by Lynn, on the correct way to write filters.
Title: Re: Easy One - Syntax Error near '=' (UDA-qos-0006 UDA-sql-0358)
Post by: Lynn on 04 Dec 2015 09:30:36 AM
We owe a lot to George Boole (https://en.wikipedia.org/wiki/George_Boole)

;D
Title: Re: Easy One - Syntax Error near '=' (UDA-qos-0006 UDA-sql-0358)
Post by: Michael75 on 04 Dec 2015 09:32:36 AM
QuoteWe owe a lot to George Boole

Nice one, Lynn :)
Title: Re: Easy One - Syntax Error near '=' (UDA-qos-0006 UDA-sql-0358)
Post by: Cognos Peasent on 04 Dec 2015 09:48:05 AM
Thank you for your answer! I'll have to check Lynn's posts out in the future!

I'm now having a new error which says

QE-DEF-0459 CCLException
QE-DEF-0260 Parsing error near...

(
extract(month,current_date) in (01,02)
and [Relational Layer].[Gaap Reporting Period].[Gaap Reporting Year] = extract(year,current_date)-1
)
OR
(
extract(month,current_date) = 03
and extract(day,current_date) <26
)
OR
(
[Relational Layer].[Gaap Reporting Period].[Gaap Reporting Year] = extract(year,current_date)
)