pgunston
pgunston

Reputation: 302

How to make an SSRS parameter = a field from another dataset

I am writing an SSRS report to create an invoice.

In my report, I have a dataset whcih runs the following query:

select Customer, Name, BillAddress, BillCity, BillState, BillZip from ARCM where ARCM.Customer = @BillCustomer and ARCM.CustGroup = 1

As you can see, I have a parameter called '@BillCustomer'.

I have another dataset which runs this query:

select Co, Customer, Invoice, TransDate, DueDate, PayTerms, CustRef  from ARBH
Where Invoice = @Invoice

How can I change my report so that @BillCustomer does not need to be manually entered when I run the report however, it gets its value from the Customer field in the second dataset?

Example

Upvotes: 2

Views: 1878

Answers (1)

zhongxiao37
zhongxiao37

Reputation: 987

Could you change your Customer dataset to use the parameter @Invoice directly and change the query to

select Customer, Name, BillAddress, BillCity, BillState, BillZip 
from ARCM where ARCM.Customer IN (
select Customer 
from ARBH
Where Invoice = @Invoice) and ARCM.CustGroup = 1

Or using JOIN in above query.

Upvotes: 1

Related Questions