Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 Reporting Services Development
 how to pass parameters for this?????

Author  Topic 

raaj
Posting Yak Master

129 Posts

Posted - 2008-05-20 : 13:51:51
Hi,
I just wanted to know how to pass the parameter for the below description: (I am having sample data something like this...)

create table employee (empid varchar(10),empname varchar(50),city varchar(20),state char(2))

insert into employee values ('100', 'Mark', 'Edison', 'NJ')
insert into employee values ('101', 'Scott', 'Reston', 'VA')
insert into employee values ('102', 'Mike', 'HarrisBurg', 'PA')
insert into employee values ('103', 'Steve', 'Ashburn', 'VA')
insert into employee values ('104', 'Danny', 'Brunswick', 'NJ')

select * from employee

create table empinfo (sequencenumber varchar(5), empid varchar(10), designation varchar(20))

insert into empinfo values ('10001', '101', 'Manager')
insert into empinfo values ('10004', '102', 'AsstManager')
insert into empinfo values ('10005', '104', 'Analyst')

select * from empinfo
create view sample1
as
select a.*,b.sequencenumber,b.designation from employee a inner join empinfo b
on a.empid = b.empid

Now when i run this(in the data tab)....select * from sample1...i get the respective results...
and in the (layout tab)i am dragging a table from toolbox and included 5 fields empid,empname,city,state,designation.

And i am dragging a text box from tool box and included sequencenumber field....

Now what i need is...for each sequencenumber the respective information should be displayed.....
i think it is possible thru passing parametes....but i dont want to enter each time the sequence number field manually to show the respective information....i want something like it should show a drop down box where i can pick what ever sequence number i want (because there are many)

any clues?????

Thanks,
Raaj....

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-05-20 : 14:30:23
You just need to create a dataset whose query will be
SELECT DISTINCT sequencenumber as value,designation as display from empinfo
Now create a new parameter in parameter tab. Give datasource option as from query and select this dataset in dataset combo and value as value and display as display fields. Now view report in preview mode and you will get dropdown with designationm values. Upon selecting a designation, the corresponding sequence number will return as parameter value. Now add it to your main dataset query
select * from sample1 where sequencenumber=@sequencenumber and in dataset properties map it to the new parameter as

parameters!yourparameter.value

Go to Top of Page

raaj
Posting Yak Master

129 Posts

Posted - 2008-05-20 : 15:14:45
Hi visakh,
Thanks for ur reply...
I am trying to do what u said....
i created a new dataset named dataset2 and included a query below as u said....SELECT DISTINCT sequencenumber as value,designation as display from empinfo.....
then i created a new parameter in the parameter tab and gave datasource option as from query and selected this dataset in dataset combo and value as value and display as display fields...
and as u said i got dropdown with designation values in the preview mode....
when i am selecting any designation and viewing the report i am getting the same values...
after this i am not able to understand this part which u said.....in dataset properties map it to the new parameter...how can i go to dataset properties and how can i map????

Thanks,
Raaj

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-05-21 : 01:55:02
quote:
Originally posted by raaj

Hi visakh,
Thanks for ur reply...
I am trying to do what u said....
i created a new dataset named dataset2 and included a query below as u said....SELECT DISTINCT sequencenumber as value,designation as display from empinfo.....
then i created a new parameter in the parameter tab and gave datasource option as from query and selected this dataset in dataset combo and value as value and display as display fields...
and as u said i got dropdown with designation values in the preview mode....
when i am selecting any designation and viewing the report i am getting the same values...
after this i am not able to understand this part which u said.....in dataset properties map it to the new parameter...how can i go to dataset properties and how can i map????

Thanks,
Raaj




just change your main dataset query from
select * from sample1 to
select * from sample1 where sequencenumber=@sequencenumber
in data tab and click ! on top
it will ask for parameter value. Give any value which you've a record and run. You will view results in grid. Click refresh dataset button on top. Now go inside dataset properties,parameters tab and see if @sequencenumber parameter is automatically mapped (mosttimes it does). If not, create a new parameter in report and map it to parameters!youraddedparameter.value.
Go to Top of Page

raaj
Posting Yak Master

129 Posts

Posted - 2008-05-27 : 10:41:12
Thanks,
That seems to be working...

Thanks again...
Raaj....
Go to Top of Page
   

- Advertisement -