SSRS Parameter
I have a Parameter in my report which gets the name of a person. The user wants to see the last name first and the first name on the parameter dropdown. But in the database it is one single field with firstname first and then lastname.
For Example:
Database field: karthik kota
parameter dropdown: kota karthik
November 29th, 2010 3:15pm
hello, this should work:
=split("John Smith", " ")(1) & " " & split("John Smith", " ")(0)
replace john smith with your database field
Free Windows Admin Tool Kit Click here and download it now
November 29th, 2010 3:46pm
When I pass this parameter should I change the SQL Query.
November 29th, 2010 3:47pm
sorry, ya this should be done in the query.
here's how you can do it if you are using a SQL server database:
select right('John Smith', CHARINDEX(' ', 'John Smith')) + ' ' + left('John Smith', CHARINDEX(' ', 'John Smith'))
Free Windows Admin Tool Kit Click here and download it now
November 29th, 2010 4:07pm
Hi Nick,
You need to change query,
declare @fullname nvarchar(100)
select @fullname = 'karthik kota'
select RIGHT(@fullname,charindex(' ',reverse(@fullname))) + ' ' + Left(@fullname,charindex(' ',@fullname)) as FullName
Just replace this in dataset which populates parameter availabe values. You can use table field in place of loacl variable.
-Chintak
November 29th, 2010 4:08pm
you might also need below link in furture:-
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=50648
Thanks
Kumarkk
Free Windows Admin Tool Kit Click here and download it now
November 29th, 2010 4:28pm
The easy way is to simply use a separate query to pull you list of values... Something like this...
SELECT UserID, FirstName + ' ' + LastName AS FullName FROM TableName
HTH,
JasonJason Long
November 29th, 2010 5:47pm
what if the field is spt rt - doe,john how can i add
=split("John Smith", " ")(1) & " " & split("John Smith", " ")(0) not to include spt rt -
thanks,JK
Free Windows Admin Tool Kit Click here and download it now
April 30th, 2011 3:08pm