The IF function does not appear to support fields as the ifTrue or ifFalse parameters.
For example using constants like this works -
IF(Discontinued,0,1)
but using a field like this doesn't -
IF(Discontinued,0,UnitPrice)
Why is this? The IF function is quite limited if we can only use constants.
Can you explain or offer a solution?
Thanks
Brian
For example using constants like this works -
IF(Discontinued,0,1)
but using a field like this doesn't -
IF(Discontinued,0,UnitPrice)
Why is this? The IF function is quite limited if we can only use constants.
Can you explain or offer a solution?
Thanks
Brian
4 Answers, 1 is accepted
0
Jarred Froman
Top achievements
Rank 1
answered on 16 Nov 2012, 02:59 PM
We are experiencing similar situations ourselves. For example, if we are evaluating nullable doubles, the following fails to evaluate:
IF(MyValue1 = null, 0, MyValue1)
whereas, this does evaluate:
IF(MyValue1 = null, 0.0, MyValue1 + 0.0)
Thanks,
Jarred
IF(MyValue1 = null, 0, MyValue1)
whereas, this does evaluate:
IF(MyValue1 = null, 0.0, MyValue1 + 0.0)
Thanks,
Jarred
0
Hi Jarred,
Didie
the Telerik team
The reason why the first expression does not work should be that the types that you return in the [ifTrue] and [ifFalse] are different. Please note that there is no implicit conversion between the two values.
Greetings,Didie
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
0
Jarred Froman
Top achievements
Rank 1
answered on 19 Nov 2012, 07:41 PM
MyValue1 is a nullable double so the following doesn't work either:
IF(MyValue1 = null, 0.0, MyValue1)
Expecting users to enter values in their strictest type is not intuitive. Is there a way of making this more forgiving for numerical values?
IF(MyValue1 = null, 0.0, MyValue1)
Expecting users to enter values in their strictest type is not intuitive. Is there a way of making this more forgiving for numerical values?
0
Hello,
Didie
the Telerik team
I am afraid that this would not be possible. You cannot control or cast the values additionally.
Greetings,Didie
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.