Click here to Skip to main content
15,888,286 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Updated 14-Feb-17 20:19pm

1 solution

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")
 
Share this answer
 
Comments
balongi 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 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 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 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 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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900