I am getting #Error as the result of an expression and could use some help.
This doe not make sense to me since the the data is on the "false" side of an
if statement.
expression 1 is: = iif ( isdate(Fields!RDD.Value) and Fields!STD.Value >0 ,
"true", "false")
... then I edited the "true" part of the if statement
expression 2 is: = iif ( isdate(Fields!RDD.Value) and Fields!STD.Value >0 ,
format(dateadd("d", (0- Fields!STD.Value ), Fields!RDD.Value),
"MM/dd/yy"),"false")
My results:
num RDD STD Result Exp1 Result Exp2
-- -- -- -- --
1 02/01/05 9 true 01/23/05
2 03/05/05 9 true 02/24/05
3 9 false #Error
4 12/25/04 0 false false
5 0 false false
Why does #3 evaluate as "false" under expression 1 and not under exression 2
as do #4 and #5?You may be having a problem with the null value for RDD - if you ensure
that RDD has some value to replace a null value (like 'Fred', or
something else obviously not a date) you may get past this.|||Thanks for the response. I have tried several variations on that and still
get the error. It still baffles me as to why it is evaluated differently
between the expressions.
"Parker" wrote:
> You may be having a problem with the null value for RDD - if you ensure
> that RDD has some value to replace a null value (like 'Fred', or
> something else obviously not a date) you may get past this.
>|||Update on this error:
After much hair pulling, it appears that the error is generated in the
dateadd part of the expression.
expression 2 is: = iif ( isdate(Fields!RDD.Value) and Fields!STD.Value >0 ,
format(dateadd("d", (0- Fields!STD.Value ), Fields!RDD.Value),
"MM/dd/yy"),"false")
This generates the error, however if I replace the "(0 - Fields!STD.Value)"
with any positive number the expression works fine. In fact 0 also works,
but any negative number or any epression that evaluates to a negative number
gives the error. Any ideas?
"bugfish69" wrote:
> I am getting #Error as the result of an expression and could use some help.
> This doe not make sense to me since the the data is on the "false" side of an
> if statement.
> expression 1 is: = iif ( isdate(Fields!RDD.Value) and Fields!STD.Value >0 ,
> "true", "false")
> ... then I edited the "true" part of the if statement
> expression 2 is: = iif ( isdate(Fields!RDD.Value) and Fields!STD.Value >0 ,
> format(dateadd("d", (0- Fields!STD.Value ), Fields!RDD.Value),
> "MM/dd/yy"),"false")
> My results:
> num RDD STD Result Exp1 Result Exp2
> -- -- -- -- --
> 1 02/01/05 9 true 01/23/05
> 2 03/05/05 9 true 02/24/05
> 3 9 false #Error
> 4 12/25/04 0 false false
> 5 0 false false
> Why does #3 evaluate as "false" under expression 1 and not under exression 2
> as do #4 and #5?|||One thing to know about IIF is that all clauses are evaluated no matter
whether the condition is true. Lots of times you will want to do:
=F(IIF(Condition, A, B)) instead of =IIF(Condition, F(A), F(B))
Hope this helps.
"bugfish69" <bugfish69@.discussions.microsoft.com> wrote in message
news:5CC22EAC-E827-4EB1-87AF-B9BC2C32531F@.microsoft.com...
> Update on this error:
> After much hair pulling, it appears that the error is generated in the
> dateadd part of the expression.
> expression 2 is: = iif ( isdate(Fields!RDD.Value) and Fields!STD.Value >0
> ,
> format(dateadd("d", (0- Fields!STD.Value ), Fields!RDD.Value),
> "MM/dd/yy"),"false")
> This generates the error, however if I replace the "(0 -
> Fields!STD.Value)"
> with any positive number the expression works fine. In fact 0 also works,
> but any negative number or any epression that evaluates to a negative
> number
> gives the error. Any ideas?
>
>
> "bugfish69" wrote:
>> I am getting #Error as the result of an expression and could use some
>> help.
>> This doe not make sense to me since the the data is on the "false" side
>> of an
>> if statement.
>> expression 1 is: = iif ( isdate(Fields!RDD.Value) and Fields!STD.Value
>> >0 ,
>> "true", "false")
>> ... then I edited the "true" part of the if statement
>> expression 2 is: = iif ( isdate(Fields!RDD.Value) and Fields!STD.Value >0
>> ,
>> format(dateadd("d", (0- Fields!STD.Value ), Fields!RDD.Value),
>> "MM/dd/yy"),"false")
>> My results:
>> num RDD STD Result Exp1 Result Exp2
>> -- -- -- -- --
>> 1 02/01/05 9 true 01/23/05
>> 2 03/05/05 9 true 02/24/05
>> 3 9 false #Error
>> 4 12/25/04 0 false false
>> 5 0 false false
>> Why does #3 evaluate as "false" under expression 1 and not under
>> exression 2
>> as do #4 and #5?
No comments:
Post a Comment