Query doesn't recognize existing ALIAS in query dialog

Hi all,
 
I receive the following error: column "Code" does not exists.
 
(SELECT value FROM table WHERE id = $P{order_id}) as Code,
sum( case when ( Code ='ME') then Weight/1000*5 else 0 end) ME,
It seems that the query doesn't recognize the subquery.
Has anyone an idea what the cause is of this error?
Thanks in advance for any help / insights.
Jason30's picture
204
Joined: Feb 9 2017 - 4:57am
Last seen: 5 years 7 months ago

3 Answers:

Jaspersoft Studio expression editor sometimes return an error message even when it's OK. Just ignore the message and save the expression and execute. Most of the time, this would work if your expression is actually valid.

hozawa's picture
170715
Joined: Apr 24 2010 - 4:31pm
Last seen: 3 years 9 months ago

Unfortunately it doesn't generate the query which holds the 'Code'.

Because of the error the field 'ME' isn't available in the report.

sum( case when ( Code ='ME') then Weight/1000*5 else 0 end) ME

Any idea's?

Thanks.

Jason30's picture
204
Joined: Feb 9 2017 - 4:57am
Last seen: 5 years 7 months ago

It doesn't recognise the alias 'CODE'.

However, the alias CODE does exists and can be used in the report.

But not in the query.

Is there a fix for this? Or an other way to achieve it?

Thanks for any help.

 

Jason30's picture
204
Joined: Feb 9 2017 - 4:57am
Last seen: 5 years 7 months ago
Feedback