July 4, 2007 at 4:57 am
Hi,
I have the following peice of code that has been working well for me for a long time. You will see below that (Not Submitted) is appended to the Description.Value based on the IIF statement. It works great!
=IIF( Fields!Date_Received.Value < "01/01/00" AND Fields!Exam_Date.Value > "01/01/00" AND NOW() > DATEADD("d",8,Fields!Date.Value) AND Fields!Mark.Value = -1, Fields!Description.Value & " (Not submitted)", IIf( Fields!Absent.Value = 1 , Fields!Description.Value & " (Absent)", Fields!Description.Value ) )
However, a requirement has now arisen that the (Not Submitted) only be appended to the Description.Value if the Description.Value does not contain the word 'Real'....I attempted the code below so far by adding to the beginning of the IIF statement..
=IIF(Fields!Description.Value NOT LIKE "%Real%" AND Fields!Date_Received.Value < "01/01/00" AND Fields!Exam_Date.Value > "01/01/00" AND NOW() > DATEADD("d",8,Fields!Date.Value) AND Fields!Mark.Value = -1, Fields!Description.Value & " (Not submitted)", IIf( Fields!Absent.Value = 1 , Fields!Description.Value & " (Absent)", Fields!Description.Value ) )
=IIF(Fields!Description.Value <> "%Real%" AND Fields!Date_Received.Value < "01/01/00" AND Fields!Exam_Date.Value > "01/01/00" AND NOW() > DATEADD("d",8,Fields!Date.Value) AND Fields!Mark.Value = -1, Fields!Description.Value & " (Not submitted)", IIf( Fields!Absent.Value = 1 , Fields!Description.Value & " (Absent)", Fields!Description.Value ) )
Both have failed so far....
Is there a better way to code this?
Thanks
July 4, 2007 at 6:36 am
Try this instead (changes in BOLD):
select
IIF( Fields!Date_Received.Value < '01/01/00'
AND Fields!Exam_Date.Value > "01/01/00"
AND NOW() > DATEADD("d",8,Fields!Date.Value)
AND Fields!Mark.Value = -1,
Fields
!Description.Value & IIF( InStr(Fields!Description.Value, 'Real') > 0, " (Not submitted)", "" )
, Fields!Description.Value & IIf( Fields!Absent.Value = 1 , " (Absent)", "" ) )
July 4, 2007 at 7:39 am
Hi Paul,
The changes do not appeared to have worked. Although I get no compilation errors when previewing the report now the field is just populated with the expression, which is a little odd.
Any ideas?
Cheers
July 4, 2007 at 8:27 am
Hi David, please change the 'SELECT' keyword at the beginning to the equal sign '='. My apologies if the code I posted was not compatible for RS.
Paul
July 4, 2007 at 9:06 am
I did try this a little earlier but still didn't have any luck.
Is it possible to use something like NOT LIKE "*Real*" in an expression?
Thanks
July 4, 2007 at 9:26 am
Try this instead:
IIF( Fields!Date_Received.Value < "01/01/00"
AND Fields!Exam_Date.Value > "01/01/00"
AND NOW() > DATEADD("d",8,Fields!Date.Value)
AND Fields!Mark.Value = -1,
Fields!Description.Value & IIF( InStr(Fields!Description.Value, "Real") > 0, "", " (Not submitted)" )
, Fields!Description.Value & IIf( Fields!Absent.Value = 1, " (Absent)", "" ) )
July 4, 2007 at 9:39 am
That looks to be working correctly!
Thank you for your help it is much appreciated.
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply