Click here to Skip to main content
11,798,866 members (45,612 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: SSRS
HI to all

please let me know how i change the cell color that based on some condition

for example :

if(startday =enddate ) then employnamee = red

means if startd day = end date then employee name come in red color other wise black.

i have search some code in google but not find relvent because my conditonal and value field are different please help me on this
Posted 4-Dec-12 5:17am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

try the following in cell background property

=IIF(Fields!Column.Value = "Approved", "Green", "No Color")

in your case it should be

=IIF(Fields!startdate.value=fields!enddate.value,"Red","No Color")
balongi at 4-Dec-12 12:25pm
but if start date is equal to end then i want to change the color for employeename
if i use avobe statement it change the color of startdate
Member 9581488 at 4-Dec-12 13:13pm
I think for that You have to write custom code(function) to check the conditions for equality of dates and then assign color code for empName cell.

Or else You can have one hidden field and assign true or false based on startdate== enddate. then use the hidden field value to change color of empname cell
balongi at 5-Dec-12 0:09am
Hi can you make a custome code for that because i am not aware with syntax please help me on this
Member 9581488 at 5-Dec-12 9:14am
Create one hidden field. Write this following in its expression
=Iif(Fields!startDate.value =Field!EndDate.value, true, False)

In emp Cell

=IIF(Fields!HdnField.value = true,"red","No Color")

Try this first. If it does not work then I will surely help for writing function.
The above solution is the shortest and easiest way.
Member 9581488 at 7-Dec-12 8:50am
=IIF(Fields!startdate.value=fields!enddate.value,"Red","No Color")
write this in emp cell.
it will work

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

  Print Answers RSS
0 CPallini 585
1 OriginalGriff 418
2 Maciej Los 345
3 Richard MacCutchan 281
4 Abhinav S 257
0 OriginalGriff 2,270
1 Maciej Los 1,810
2 KrunalRohit 1,496
3 CPallini 1,425
4 Richard MacCutchan 1,109

Advertise | Privacy | Mobile
Web02 | 2.8.151002.1 | Last Updated 4 Dec 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100