Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Using Parameters in SQL expressions Post Reply Post New Topic
Author Message
vgillis
Newbie
Newbie


Joined: 05 Mar 2013
Online Status: Offline
Posts: 10
Quote vgillis Replybullet Topic: Using Parameters in SQL expressions
     Posted: 28 Mar 2013 at 8:58am
Hi all.
I am trying to write an SQL expression that uses date parameters that are used for the data on the main report.

A subreport will not work because my report is grouped and I need the values returned to be based on the group in the group footer section.


So..I tried this..

(Select sum(pledge_amt) from aa_pledge_detail Where
pledge_date >= '{?DateMin}’ and pledge_date <= '{?DateHigh}' and designation_key = "AA_GIFT_DETAIL.DESIGNATION_KEY")

I get a lovely error saying that my date year can not be 0. I tried added the to_date function to my parameters but I get the same error.


UPDATE So I guess I can't use parameters in SQL expressions. So I tried a command object which does what I want it too. but when I run the report I have to enter the date parameters twice. Once for the main report and again for the command object. Is there anyway around this?

Thanks!![

Edited by vgillis - 28 Mar 2013 at 9:27am
IP IP Logged
Sastry
Moderator
Moderator
Avatar

Joined: 16 Jul 2012
Online Status: Offline
Posts: 537
Quote Sastry Replybullet Posted: 29 Mar 2013 at 1:42am
Hi

Try to create a parameter with same name i.e. Your report parameter name, type should match with command parameter name and type.

Then it will display only once.
Thanks,
Sastry
IP IP Logged
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