Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Table value with different label 1

Status
Not open for further replies.

mchambers

MIS
Aug 28, 2008
56
US
Hello

I have in my sql table ex: column name c_gender(in my database gender is displayed as 1 for male and 2 for female) In my report I need to display male or female instead of 1 or 2. The descriptions are in another table column name c_desc.

How in reporting services do I keep the value as c_gender but display c_desc?

In my layout in reporting services I have a row of client data basic demographics race, county, etc... and I am having difficultly figuring it out and it is driving me insane. I know that in charts there is a label but not in the regular table layout. HELP ME PLEASE
 
in the SELECT statement use an alias with a CASE statement:
Code:
SELECT c_gender,
	[c_desc] = CASE WHEN c_gender = 1 THEN 'Male' ELSE 'Female' END
FROM Table1

Adjust as needed. That way you have both fields available for use in the report.

--------------------------------------------------
Bluto: What? Over? Did you say "over"? Nothing is over until we decide it is! Was it over when the Germans bombed Pearl Harbor? No!
Otter: Germans?
Boon: Forget it, he's rolling.
--------------------------------------------------
 
Thanks, but I just used custom code in the report to give each field a description.
 
Not even any need for that tbh:

=iif(Fields!c_gender.Value =1, "Male","Female")

as an expression will do...

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
Thanks xlbo, One more question:

How would you write it if 1 and M = Male?
 
No probs:

=iif(Fields!c_gender.Value=1 AND Fields!OtherField.Value = "M", "Male","Female")

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top