Select field applies to 4 fields
I am creating a report that has two fields to query on i.e. DateFrom and DateTo. I have four fields in a table i.e. Date1, Date2, Date3, Date4. I want that when the report is ran that the DateFrom and DateTo applies to all 4 date fields and the Select is any records that the DateFrom and DateTo apply to in either Date1 or Date2 or Date3 or Date4. Anyone any ideas? Thanks.
September 28th, 2012 10:33am

Hi JMcCon, If I understand you correctly, you want to use two variables "DateFrom" and "DateTo" to filter the four date fields of the report. To achieve your goal, we can add parameters to your report. By including parameters for a report, users are prompted for a value or values when they run the report, and the dataset query retrieves only the data that is requested. The dataset query includes query parameters and Reporting Services automatically creates corresponding report parameters that are indirectly linked to the query parameters. You can change the report parameter properties in the report design tools to include a valid values list and a user prompt that displays at run time. To add parameters to the report, you can refer to the following articles: Tutorial: Adding a Parameter to Your ReportLesson 1: Adding Parameters to Filter Reports by Date In this issue, you can modify the WHERE clause in the query as follows: WHERE (Date1 BETWEEN (@DateFrom) AND (@DateTo)) OR (Date2 BETWEEN (@DateFrom) AND (@DateTo)) OR (Date3 BETWEEN (@DateFrom) AND (@DateTo)) OR (Date4 BETWEEN (@DateFrom) AND (@DateTo)) Of course, you can also use the HAVING caluse to replace WHERE clause in the query. Regards, Mike Yin TechNet Subscriber Support If you are TechNet Subscription user and have any feedback on our support quality, please send your feedback here.Mike Yin TechNet Community Support
Free Windows Admin Tool Kit Click here and download it now
October 2nd, 2012 6:04am

Hi JMcCon, If I understand you correctly, you want to use two variables "DateFrom" and "DateTo" to filter the four date fields of the report. To achieve your goal, we can add parameters to your report. By including parameters for a report, users are prompted for a value or values when they run the report, and the dataset query retrieves only the data that is requested. The dataset query includes query parameters and Reporting Services automatically creates corresponding report parameters that are indirectly linked to the query parameters. You can change the report parameter properties in the report design tools to include a valid values list and a user prompt that displays at run time. To add parameters to the report, you can refer to the following articles: Tutorial: Adding a Parameter to Your ReportLesson 1: Adding Parameters to Filter Reports by Date In this issue, you can modify the WHERE clause in the query as follows: WHERE (Date1 BETWEEN (@DateFrom) AND (@DateTo)) OR (Date2 BETWEEN (@DateFrom) AND (@DateTo)) OR (Date3 BETWEEN (@DateFrom) AND (@DateTo)) OR (Date4 BETWEEN (@DateFrom) AND (@DateTo)) Of course, you can also use the HAVING caluse to replace WHERE clause in the query. Regards, Mike Yin TechNet Subscriber Support If you are TechNet Subscription user and have any feedback on our support quality, please send your feedback here.Mike Yin TechNet Community Support
October 2nd, 2012 6:20am

Hi JMcCon, If I understand you correctly, you want to use two variables "DateFrom" and "DateTo" to filter the four date fields of the report. To achieve your goal, we can add parameters to your report. By including parameters for a report, users are prompted for a value or values when they run the report, and the dataset query retrieves only the data that is requested. The dataset query includes query parameters and Reporting Services automatically creates corresponding report parameters that are indirectly linked to the query parameters. You can change the report parameter properties in the report design tools to include a valid values list and a user prompt that displays at run time. To add parameters to the report, you can refer to the following articles: Tutorial: Adding a Parameter to Your ReportLesson 1: Adding Parameters to Filter Reports by Date In this issue, you can modify the WHERE clause in the query as follows: WHERE (Date1 BETWEEN (@DateFrom) AND (@DateTo)) OR (Date2 BETWEEN (@DateFrom) AND (@DateTo)) OR (Date3 BETWEEN (@DateFrom) AND (@DateTo)) OR (Date4 BETWEEN (@DateFrom) AND (@DateTo)) Of course, you can also use the HAVING caluse to replace WHERE clause in the query. Regards, Mike Yin TechNet Subscriber Support If you are TechNet Subscription user and have any feedback on our support quality, please send your feedback here.Mike Yin TechNet Community Support
Free Windows Admin Tool Kit Click here and download it now
October 2nd, 2012 6:20am

Thanks Mike.
October 3rd, 2012 11:07am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics