if a question abot ms report server.
i have two fields ,
field1 : name = gender value = 1 for men and 2 for woman
field 2 : name = lastname value = for example "jenkins"
so what i want to do is if gender = 1 (men) then i want to set the background colour of the field2(name) blue
else (gender = 2) i want to set the background colour of the field2(name) red.
do anyone know how i could do this ??
i'am a "newcommer" in the world of reporting services ,i always used crystal report for creating my reports.
thanks
patrickHi,
Here is a trick but most of programmers do not recommend it (Me too).
You fire the query as
Select [Name]=(Case When Gender=1 then '<font style=''backgroundcolor:blue;''>' + lastname + '<font>' Else '<font style=''backgroundcolor:red;''>' + lastname + '<font>' End )
Remember this is not recommended but you can use it in urgency.
Regards,
Hemchand.|||
Hello:
Is Gender ALWAYS a 1 or a 2?
In the field (Field2:name=LastName) within Report Layout - Select Properties (Right Side under Solutions Explorer) -
Click on BackGround (you will get a down arrow and scroll and look for Expression - Expressions is always at the top of the list)
In the Expression Box enter the following:
=iif(Field!:Gender.Value = "1", "Blue", "Red")
I probably do not have your field named correctly but you can enter =iif(THEN SELECT YOUR FIELD FROM THE DATASET and then append the remainder of the above statement.
Hope this helps!
Best Regards,
Joe
No comments:
Post a Comment