Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
hbadministrator
Posting Yak Master
120 Posts |
Posted - 2014-01-14 : 12:01:18
|
Need help with color flag.I have a field that gets current date =Globals!ExecutionTime and another 2 fields that have the month and year. =Fields!BudgetPrd.Value and =Fields!BudgetYear.Value.What I am trying to accomplish is current month and year minus budget prd and year must be greater than 2 months apart for me to flag the field yellow. For the life of me I can't figure anyway to write this. example would be 1/14/2014 - 10/2013 is more than 2 months so flag that record. Any help would be greatly appreciated. |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2014-01-15 : 07:09:50
|
set below expression for background color=IIF(DateDiff(DateInterval.Month,DateSerial(Cint(Fields!BudgetYear.Value),Cint(Fields!BudgetPrd.Value),Cint(1)),Globals!ExecutionTime)> 2 ,"yellow","None")------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
hbadministrator
Posting Yak Master
120 Posts |
Posted - 2014-01-16 : 08:49:51
|
here is the message I get.The BackgroundColor expression for the text box ‘BudgetPrd’ contains an error: Input string was not in a correct format.=IIF(DateDiff(DateInterval.Month,DateSerial(Cint(Fields!BudgetYear.Value),Cint(Fields!BudgetPrd.Value),Cint(1)),Globals!ExecutionTime)> 1 ,"yellow","White")I changed the 2 to a 1 just to see if it was working correctly but still didn't show anything. |
|
|
hbadministrator
Posting Yak Master
120 Posts |
Posted - 2014-01-16 : 10:56:22
|
ok so actually to get it to show correct answer it would need to be take they year x 12 then add the month. Then take current year x12 +current month. if difference is >2 then yellow. |
|
|
hbadministrator
Posting Yak Master
120 Posts |
Posted - 2014-01-16 : 11:19:49
|
=IIF((Year(Today)*12+Month(Today))-((Fields!BudgetYear.Value)*12+(Fields!BudgetPrd.Value))>2,"yellow","White") This is the answer to my question Thank you Visakh16 |
|
|
|
|
|
|
|