当前位置: 动力学知识库 > 问答 > 编程问答 >

sql server - SSRS parameters, populating the available fields list

问题描述:

When producing a list of available parameter properties, rather than manually typing each persons name in one by one, is there any way of just populating the data from the table/view which holds all the possible names?

I assume its in the circled box however all that does it let me point to a dataset and then field which I have tried selecting StaffName (being the field that is the one I'm using) if I then run the report it falls over.

网友答案:

SSRS's concept of a query is largely tied to a data set that you define in Report Data.

When you choose 'Use a query', you should be choosing a pre-defined query from Report Data. Of course, the good news is that you can define these yourself.

So let's take your example. You want your possible parameter options to be StaffNames.

Create a new dataset in Report Data. It should return all possible staff names for your report.

Something like:-

SELECT DISTINCT 
  StaffName,
  StaffID
FROM
  MyReportViewOrTable

Once you have defined this dataset, you should be able to use it as a source of parameter values.

网友答案:

Add a new dataset to the report, maybe called StaffMembersDS. The SQL for it might look like:

SELECT Id, Name
FROM StaffMember;

Then assign Name to Label and Id to Value.

BTW if this is related to your last question you're going to run into the trouble that when a user picks a staff member name from the drop down list they are picking only one value. So for your case you might want the Value field to be tied to Name as well as the label. That would allow you to use the query in your last question - SSRS Parameters - which collects related Id values.

分享给朋友:
您可能感兴趣的文章:
随机阅读: