There are several ways to do this.
Common Lookup method
This is the way most people would probably do this
Use the Lookup()
function.
Set the tablix row's hidden
property to something like
=ISNOTHING(
Lookup(Fields!IDa.Value,Fields!IDb.Value,Fields!IDb.Value,"Dataset2")
) = False
The above, for clarity, assumes the ID column in dataset1 is called IDa
and the ID column from dataset2 is called IDb
. It will stil work if they have the same name (e.g. 'ID')
Note: Dataset name must be in quotes and is case sensitive.
Using this method returns all the rows and simply hides the ones that do not match your criteria. This may not be ideal if you're exporting the data. If not, see the alternative version below.
Alternative method
For reasonably small datasets - parameter method
... and because I thought it was an interesting approach...
This second method uses a hidden parameter and is easy to setup assuming you have a reasonable small number of records.
Using your example, create a parameter called List2
and set its default and available values BOTH to your Dataset2
query (from your example above). Make the parameter multi-value. You can make this parameter hidden once it's working.
Now Your Dataset1
query can be a simple query like this,
SELECT * FROM Table1 WHERE id NOT IN (@List2)
@List2 will contain the values from datset2 (1,2 and 3) so the query will return only the remaining values.
Note I named the datasets to match your example but the datasets must be created in the order above.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…