Click here to Skip to main content
15,917,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In SSRS report,I am using total 4 parameters,Parameter "P ID" value is retrieved from parameter "T ID",similarly parameter "R ID" value is retrieved from parameter "P ID".
Case 1:
I Selected only "T ID" then
If parameter "R ID" & "P ID" both having data for particular "T ID",then retrieves data & display report.

Case 2:
I Selected only "T ID" then
If parameter "R ID" & "P ID" both don't have data for particular "T ID",then shows error as
"Parameter "P ID" is missing a value"


What I have tried:

In parameter dataset ,I have added default "null" value for both "P ID" & "T ID" parameters & also in their dataset.

select R.name,R.id from request R,distribution P
where P.requestdetail =R.gems_id
and P.gems_distributionId=@PlacementID
union 
select null,null


Above working for case 2 only,but actually I want automatic selection of Id,after selecting "T ID",I want "P ID" & "R ID".
Please suggest
Posted
Updated 21-Apr-17 0:29am

1 solution

Hi,

you can try if exists in your query to check result..

IF EXISTS
(select R.name,R.id from request R,distribution P
where P.requestdetail =R.gems_id
and P.gems_distributionId=@PlacementID
)

BEGIN
select R.name,R.id from request R,distribution P
where P.requestdetail =R.gems_id
and P.gems_distributionId=@PlacementID;
END
ELSE
BEGIN
select null,null
END
 
Share this answer
 
Comments
Nilima Ukande 21-Apr-17 6:40am    
Thanks,its working
Can any one provide solution for query optimization

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900