I changed my expression to the following, and Blue does not work.
I know the instr(first(Fields!CompletedDateTime.Value),"/") expression does work because I put it as the value in the cell and when there was a "/" I got the letter count. I believe the problem is relating to the first expression being string related and
the others are numeric.
In the below case all of the colours are working except for blue.....
I think it is because on the first switch, it is treating it as a string, whereas on the subsequent ones, it is an integer. I just don' t yet know how to fix it. ... or even what scripting language it is...!
I believe it is because the first if statement is treating the cell value as a string, and subsequently the others are treating the cell value as an integer.
This problem I can't seem to work out. I have tried just about every technique available but I can't get the four colours going as above.
pizzamaker74
Member
429 Points
369 Posts
Script for background colour of cell in RDLC
Feb 09, 2012 12:42 AM|LINK
I am trying to programatically set the cell colour in an RDLC cell.
I am using
=iif(instr(First(Fields!CompletedDateTime.Value),"/") > 0 ,"PowderBlue",iif(instr(First(Fields!CompletedDateTime.Value),"-"),iif(First(Fields!CompletedDateTime.Value) = "-1"), "Yellow","LimeGreen"),"LimeGreen"))
Can anyone see why this expression does not work?
Nishantg
Participant
1254 Points
277 Posts
Re: Script for background colour of cell in RDLC
Feb 10, 2012 07:19 AM|LINK
I think you miss to check the value for InStr function here
iif(instr(First(Fields!CompletedDateTime.Value),"-")
Try this one, iif(instr(First(Fields!CompletedDateTime.Value),"-")>0 and I think it should work.
Thanks
Nishant
pizzamaker74
Member
429 Points
369 Posts
Re: Script for background colour of cell in RDLC
Feb 13, 2012 10:38 PM|LINK
Unfortunately it does not work.
I changed my expression to the following, and Blue does not work.
I know the instr(first(Fields!CompletedDateTime.Value),"/") expression does work because I put it as the value in the cell and when there was a "/" I got the letter count. I believe the problem is relating to the first expression being string related and the others are numeric.
In the below case all of the colours are working except for blue.....
=Switch(
instr(first(Fields!CompletedDateTime.Value),"/"), "Blue",
first(Fields!CompletedDateTime.Value) >= 14, "Green",
first(Fields!CompletedDateTime.Value) >= 0 ,"Yellow",
first(Fields!CompletedDateTime.Value) < 0 , "Red"
)
jeeveshfulor...
Participant
1576 Points
289 Posts
Re: Script for background colour of cell in RDLC
Feb 14, 2012 05:52 AM|LINK
condition is not there in your first statement, switch will work with condition.
try to put something like that :-
=Switch( instr(first(Fields!CompletedDateTime.Value),"/")> 0, "Blue", first(Fields!CompletedDateTime.Value) >= 14, "Green", first(Fields!CompletedDateTime.Value) >= 0 ,"Yellow", first(Fields!CompletedDateTime.Value) < 0 , "Red" )vinay13mar
Star
7778 Points
1632 Posts
Re: Script for background colour of cell in RDLC
Feb 14, 2012 05:58 AM|LINK
Check the link
http://beta-forums-asp.neudesic.com/t/1729564.aspx/1
V.K.Singh
pizzamaker74
Member
429 Points
369 Posts
Re: Script for background colour of cell in RDLC
Feb 15, 2012 04:48 AM|LINK
Na, that didn't help unfortunately.
I think it is because on the first switch, it is treating it as a string, whereas on the subsequent ones, it is an integer. I just don' t yet know how to fix it. ... or even what scripting language it is...!
pizzamaker74
Member
429 Points
369 Posts
Re: Script for background colour of cell in RDLC
Feb 21, 2012 02:31 AM|LINK
So the Cell colour is determined by the contents of the cell (conditional formatting) and the cell content can take one value;
[First(CompletedDateTime)]
This content is formatted to System.String in the RDLC
But the cell takes on an integer value if it is not a date.
i.e.
'Feb 13 2012 5:11PM'
or -33
or 27
or -244
etc.
I want it to be blue if it shows a date, and then other colours depending on the value of the integer.
i.e. for this expression:
= iif(InStr(Fields!CompletedDateTime.Value, "M") > 0 ,"Blue","")
The Cell goes blue !! Great.
But when I write this expression:
= iif(InStr(first(Fields!CompletedDateTime.Value), "M") > 0 ,"Blue",
iif(first(Fields!CompletedDateTime.Value) >= 14, "Green",
iif(first(Fields!CompletedDateTime.Value) >= 0 ,"Yellow",
iif(first(Fields!CompletedDateTime.Value) < 0 , "Red", "Blue"
))))
I get all of the colours except blue.......
I believe it is because the first if statement is treating the cell value as a string, and subsequently the others are treating the cell value as an integer.
This problem I can't seem to work out. I have tried just about every technique available but I can't get the four colours going as above.
Any ideas?
p.
Oscar Gomez
Member
40 Points
21 Posts
Re: Script for background colour of cell in RDLC
Feb 23, 2012 03:57 AM|LINK
Hi,
The link doesn't answer the question. :(
_______________-
Oscar Gómez
Engineer at PSL
http://www.pslcorp.com/
pizzamaker74
Member
429 Points
369 Posts
Re: Script for background colour of cell in RDLC
Feb 24, 2012 06:20 AM|LINK