Print Page | Close Window

Parameter Based on Query

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=23024
Printed Date: 29 Apr 2024 at 11:27am


Topic: Parameter Based on Query
Posted By: jsh8286
Subject: Parameter Based on Query
Date Posted: 04 Nov 2022 at 10:23am
Have an SQL query (Command) from our database as follows:

select CUSTOMER As CUSTOMER,BILNAME As CUSTNAME,INVNUMBER As DOCNUMBER, INVDATE As DOCDATE, SHSOURCURR As SCURN, SALESPER1 As SALSPERSON1, SALESPER2 As SALSPERSON2, SALESPER3 As SALSPERSON3, SALESPER4 As SALSPERSON4, SALESPER5 As SALSPERSON5, SHIPTO As SHIPTO, INVNETNOTX As TOTALNETNOTAX, INVMISC As MISC ,ITEM As ITEMNUM, MSLDAT.dbo.OEINVD.[DESC] As Description,LINETYPE As LINETYPE, QTYSHIPPED As QTYSHIPRET, UNITPRICE, UNITWEIGHT, INVUNIT As SELLRETUNIT, UNITCONV As UNITCONV, PRIUNTCONV As PRIUNTCONV, PRICEUNIT As PRICEUNIT, INVDISCAMT As DISCOUNT, INVDISCPER As DISCPERCENTAGE from MSLDAT.dbo.OEINVH
JOIN
MSLDAT.dbo.OEINVD ON OEINVH.INVUNIQ = OEINVD.INVUNIQ

union all

select CUSTOMER As CUSTOMER,BILNAME As CUSTNAME, CRDNUMBER As DOCNUMER, CRDDATE As DOCDATE, CRSOURCURR As SCURN, SALESPER1 As SALSPERSON1, SALESPER2 As SALSPERSON2, SALESPER3 As SALSPERSON3, SALESPER4 As SALSPERSON4, SALESPER5 As SALSPERSON5, SHIPTO As SHIPTO, CRDNETNOTX As TOTALNETNOTAX, CRDMISC As MISC ,ITEM As ITEMNUM, MSLDAT.dbo.OECRDD.[DESC] As Description,LINETYPE As LINETYPE ,QTYRETURN As QTYSHIPRET, UNITPRICE,UNITWEIGHT,CRDUNIT As SELLRETUNIT, UNITCONV As UNITCONV, PRIUNTCONV As PRIUNTCONV, PRICEUNIT As PRICEUNIT, CRDDISCAMT As DISCOUNT, CRDDISCPER As DISCPERCENTAGE from MSLDAT.dbo.OECRDH
JOIN
MSLDAT.dbo.OECRDD ON OECRDH.CRDUNIQ = OECRDD.CRDUNIQ

Above union query works well until I try to add a parameter to it. The parameter being I want to pick a starting item number and ending item number from a drop down list but trying to create the parameter via the command prompt I am getting nowhere.

Any suggestions would be greatly appreciated.

Thanks in advance.



Replies:
Posted By: hilfy
Date Posted: 03 Jan 2023 at 8:37am
You'll need two parameters instead of one - one for beginning and one for ending - you can't use a range prompt in a command. For a good explanation of working with params in commands see https://blogs.sap.com/2015/04/01/best-practices-when-using-commands-with-crystal-reports/, which I wrote several years ago. Even though it's older, the information is still relevant.

-Dell

-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics



Print Page | Close Window