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.
Author |
Topic |
Nivas
Starting Member
6 Posts |
Posted - 2009-01-28 : 15:36:18
|
Hi,Im facing problem in creating a parameter which is a column in the Report.This column is derived from a formula on multiple columns from the dataset.Let me explain with the example.Student_TableStudentID CountryCode Age1 I 102 US 203 UK 304 AUS 225 CHN 116 US 227 US 218 US 239 US 2410 US 25Country_Table CountryID CountryNameI INDIAUS USAUK UNITEDKndmAUS AUSCHN CHINAQuery to combine these two table:select studentid,countrycode,age,countrynmaefrom dbo.student INNER JOIN dbo.countryON countrycode=countryId StudentID CountryCode Age CountryName1 I 10 INDIA2 US 20 USA3 UK 30 UNITEDKndm4 AUS 22 AUS5 CHN 11 CHINA6 US 22 USA7 US 21 USA8 US 23 USA9 US 24 USA10 US 25 USA Now in SSRS first dataset "Master"Dataset query : select studentid,countrycode,age,countrynmaefrom dbo.student INNER JOIN dbo.countryON countrycode=countryIdwhere countrycode IN(@country)second dataset "Countrycode"dataset Query: select countryId from countryThe table in layout contain StudentId,countrycode,CountryName,Age.Now in the table i need a new column "ValidValue"condition in "ValidValue" column:=iif(Fields!countrycode.Value="US" and Fields!age.Value> 18,"Y","N")The question is How to create a Multi-value-parameter as "ValidValue" with ( "Y"/"N") values.The report should display the data based on the "countrycode" and "Validvalue" parameters.Please respond !!Thanks |
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2009-01-28 : 19:29:16
|
Did you mean this?Select studentid,countrycode,age,countryname,(Case when countrycode ='US' and age>18 then 'Y' else 'N' end)as Validvaluefrom dbo.student INNER JOIN dbo.countryON countrycode=countryIdwhere countrycode IN(@country) |
 |
|
Nivas
Starting Member
6 Posts |
Posted - 2009-01-29 : 12:44:57
|
Yes This works!!!But which is better option to use between the followingwriting the condition in textbox expression or in the query in Data tab1)=iif(Fields!countrycode.Value="US" and Fields!age.Value> 18,"Y","N") writing this in Validvalue Textbox OR 2)(Case when countrycode ='US' and age>18 then 'Y' else 'N' end)as Validvalue and drag this dataset value in to the Validvalue textbox in the layout?Thanks |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-01-29 : 13:01:06
|
if this is only for display in report better do this in report textbox expression |
 |
|
|
|
|
|
|