Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
235 views
in Technique[技术] by (71.8m points)

sql server - In SSRS 2008, how are parameters passed down to the DatSet Query... or can they?

In SSRS 2008, how are parameters passed down to the DatSet Query... or can they?

I have a simple question. I think this is pretty straight-forward. If necessary, I can include screen shots of what I mean.

Here is the basic format of the report. I have a SSRS report made on Visual Studio 2017. it has two DataSets. It has one Tablix and one Bar Chart that is loaded with from the DataSets. I have one Parameter defined for the report. The parameter a Date/Time data type set to allow nulls and I name it rundate. (I will use is in a data driven subscription, but for now that is beyond the scope of my question here)

Ffor each dataset, I have gone into the Datset Properties and added a parameter with a Parameter Name of rundate and Parameter Value [@rundate]. I think it would be great if I make this somehow a variable in the Query for the Dataset. I assume that this is exactly what this is supposed to be used for. How do I declare it in the SQL query.

I said that this was a pretty straight forward question. it should be easily answered and it will save time in digging around the internet for the answer. So far, all I have found is how to set up filters. This is not exactly the same sort of thing. But, if necessary, I guess I could resort to using filters but it will take some changes in the query. And it would be a mess.

https://reportsyouneed.com/ssrs-tip-put-parameters-in-your-query-not-your-filter/ offers a solution and this graphic on this page makes it look easy enter image description here and I have tried something similar with my own WHERE clause: WHERE (InsertedDate > @rundate) But in preview, I get this enter image description here

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

In the query designer drag a dimension on top of your report. Chose an Operator and a Filter and check the checkbox by Parameters and BOOOM you have your parameter. If you go now into your report designer you find the parameter you just checked in the folder Parameters on the left navigation pane (on top of the Datasets folder). Now open the folder an right click on your parameter for the properties.

You can set now a default value. If not the report opens and waits until a users selects a value from the drop down selection. After the selection the parameter gets passed to the query and the query gets executed and the report rendered.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...