Print Page | Close Window

Changing SQL Expressions

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=12364
Printed Date: 04 May 2024 at 2:12am


Topic: Changing SQL Expressions
Posted By: yggdrasil
Subject: Changing SQL Expressions
Date Posted: 18 Feb 2011 at 3:27am

I have a report which uses an SQL Expression to determine a value related  to an Involvement. Nowadays, I tend to write my reports with Commands from the start, so slotting in a subquery is no problem. But this one was built with tables.

The SQL Expression is

(SELECT vv.UDF_VALUE 
FROM   VIEW_UDF_ENTITY_VALUE vv INNER JOIN UDF_ENTITYTYPE_LINK ulnk
ON vv.UDF_ENTITY_LINK_ID=ulnk.UDF_ENTITY_LINK_ID
 INNER JOIN UDF_DEFINITION udef ON ulnk.UDF_ID=udef.UDF_ID
 WHERE  udef.UDF_ID=10250  and vv.ENTITY_ID="INVOLVEMENT"."INVOLVEMENT_ID")

which worked fine.  Then I got informed there was a lookup table and I needed to show the description instead of the value. So I changed it to

 (SELECT lk.description
FROM   VIEW_UDF_ENTITY_VALUE vv INNER JOIN UDF_ENTITYTYPE_LINK ulnk
ON vv.UDF_ENTITY_LINK_ID=ulnk.UDF_ENTITY_LINK_ID
 INNER JOIN UDF_DEFINITION udef ON ulnk.UDF_ID=udef.UDF_ID
left outer join udf_lookups lk on vv.udf_value = lk.int_code
 WHERE  udef.UDF_ID=10250  and vv.ENTITY_ID="INVOLVEMENT"."INVOLVEMENT_ID")

And now it fails saying "INVOLVEMENT"."INVOLVEMENT_ID" is not a valid expression.
I think this is to do with the way crystal parses SQL expressions. Once in there, always in there, even  if deleted. I have tried all sorts of ways to get it to accept it, but no go.
Any suggestions, short of rebuilding the report? Which, in frustration, I have done in the past.  But this one is a bit big.

Thanks



Print Page | Close Window