Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing Parameter to Sql Statement 2

Status
Not open for further replies.
Jun 14, 2008
16
US

Hi there....newbie here trying to use Crystal Reports 8.5....

I am trying to create a new sql expression field called BatchCount in the subreport. The sql i wrote for it is:

(select count(distinct batch_id) from audit_batch inner join LU_Application on audit_batch.cur_workstate=LU_Application.workstate
where audit_batch.useraction_id=26 and audit_batch.actiontimestamp between '2008-01-01' and '2008-01-14' and LU_Application.Mnemonic='SubDocRepair')

This works fine and gives me the count as 13.

Now I wanna replace the hardcoded values with values passed by the user. So instead of 'SubDocRepair', I put {?Mnemonic where Mnemonic is a parameter I created which will accept user input. So now it looks like this:

(select count(distinct batch_id) from audit_batch inner join LU_Application on audit_batch.cur_workstate=LU_Application.workstate
where audit_batch.useraction_id=26 and audit_batch.actiontimestamp between '2008-01-01' and '2008-01-14' and LU_Application.Mnemonic={?Mnemonic)

However this keeps erroring up. Also the Mnemonic parameter is a string and the LU_Application.Mnemonic is a varchar field. Does that matter? I wanna be able to do the same for the dates too...

Any clues...pls Help:(

Thanks in advance:)
 
Where does the total go? Is it for a group or a grand total?

-LB
 
You said the subreports were in the detail section of the main report. Have you moved them?

Are you trying to get a total for the entire report?

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top