Forum Discussion
Report Builder filtering table based off another table parameters
- Anonymous1 year ago
Hi,Spikenaylor . I am glad to help you.
If you use the Filters function to filter the dataset, the system selects the parameter with a (0) suffix by default.
If this is the case for you, you need to remove “(0)” and make the whole parameter a list of values, so that the corresponding data can be filtered properly (I think there is an error in your parameter configuration settings)
this is my test data:If you want to implement a similar join query (or more complex query logic for datasets, I'd prefer that you write the query statement artificially)
Using query statements + query parametersLike this:
Set up a separate parameter value dataset for the report parameters to get the corresponding parameter values.
The dataset DataSetMainTablePar used by the parameter [MonthCompleted]
SELECT DISTINCT MainTable.Completion_Month FROM MainTableThis is then used in the final dataset to set the correct query parameters
I'm using a SQL Server datasource
You need to ensure that:
1. the parameters are set up with the correct type, whether they contain multiple values, (use “=” or “IN” in the query) 2. the parameter mapping is set correctly 3. Query parameters are used correctly in the query statement
This is my query code:SELECT d.* FROM DeliveryTable d JOIN MainTable m ON d.Delivery_Month = m.Prep_Month WHERE m.Completion_Month in ( @MonthCompleted );I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.
Best Regards,
Carson Jian,
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi,Spikenaylor . I am glad to help you.
If you use the Filters function to filter the dataset, the system selects the parameter with a (0) suffix by default.
If this is the case for you, you need to remove “(0)” and make the whole parameter a list of values, so that the corresponding data can be filtered properly (I think there is an error in your parameter configuration settings)
this is my test data:
If you want to implement a similar join query (or more complex query logic for datasets, I'd prefer that you write the query statement artificially)
Using query statements + query parameters
Like this:
Set up a separate parameter value dataset for the report parameters to get the corresponding parameter values.
The dataset DataSetMainTablePar used by the parameter [MonthCompleted]
SELECT
DISTINCT
MainTable.Completion_Month
FROM
MainTable
This is then used in the final dataset to set the correct query parameters
I'm using a SQL Server datasource
You need to ensure that:
1. the parameters are set up with the correct type, whether they contain multiple values, (use “=” or “IN” in the query)
2. the parameter mapping is set correctly
3. Query parameters are used correctly in the query statement
This is my query code:
SELECT d.*
FROM DeliveryTable d
JOIN MainTable m ON d.Delivery_Month = m.Prep_Month
WHERE m.Completion_Month in ( @MonthCompleted );
I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.
Best Regards,
Carson Jian,
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.