developer
developer

Reputation: 5478

Passing parameters in crystal reports sql command query

I am trying to add a parameter to SQL commands in Crystal report and it errors out. Below is my query

select r.ID as ActivityRequestID, count(c.ID) as ChangeCount from Change c join ActivityRequest r on c.ObjID=r.ID 
where (c.Class='ActivityRequest' and c.ChangeType='Modified' and (c.PropertyName='Definition' or c.PropertyName='Registration') and ({c.Performed} >={?ChangesSince} ) ) group by r.ID

I went to database expert and created the above command. Now when I try to save the command it gives me the error. 'Failed to retriever data from database. No value given for one or more parameters'. Now the user selects the parameter when the report loads and there is no hard coded value that I can give. Please tell me a way to fix the above problem.

Upvotes: 0

Views: 15110

Answers (1)

user359040
user359040

Reputation:

I think you have inadvertently included a couple of braces where they are not needed, around {c.performed} - try this:

select r.ID as ActivityRequestID, 
       count(c.ID) as ChangeCount 
from Change c 
join ActivityRequest r on c.ObjID=r.ID 
where c.Class='ActivityRequest' and 
      c.ChangeType='Modified' and 
      (c.PropertyName='Definition' or 
       c.PropertyName='Registration') and 
      c.Performed >={?ChangesSince}  
group by r.ID

Upvotes: 4

Related Questions