Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: Parameter Field within SQL Expression Field Post Reply Post New Topic
Author Message
SonoItaliano
Newbie
Newbie


Joined: 02 Aug 2012
Location: United States
Online Status: Offline
Posts: 9
Quote SonoItaliano Replybullet Topic: Parameter Field within SQL Expression Field
    Posted: 02 Aug 2012 at 2:57am
In Crystal Reports XI, is there truly no way whatsoever to refer to an input Parameter Field (ex: {?myParameter}) within a SQL Expression Field?
 
Any way to workaround this limitation?
 
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3701
Quote hilfy Replybullet Posted: 02 Aug 2012 at 8:58am
Correct, there is no way to do that as the expression is passed to the database "as is" without being parsed by Crystal.
 
It's not hard to get around this limitation if you have fairly good SQL skills.  I would do the following:
 
1.  Create a new report (this is MUCH easier than editing an existing rpt!)
2.  Outside of Crystal, create a query that will return ALL of the data for your report, including the expression where you want to use the parameter.
3.  In your report, instead of selecting tables, create a Command.
4.  Add the SQL created in step 2 to the command.
5.  For each parameter in the query, create a parameter in the Command Editor.  NOTE:  Commands will NOT work with params that are created in the report itself!
6.  For each parameter you want to use in the query, place your cursor where you want the param, then double-click on the parameter.  NOTE:  if any of your commands are strings, you will have to put quotes around the parameter in the query.  For example: '{?MyStringParam}'
7.  Save the command.
8.  Design your report.
 
-Dell
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.