Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi I am trying to evaluate this "If" statement, but it doesn't work as expected:
If(Priority= 'Critical',if(Mins>60,1,0),'NC') as MissFlg
Below is the data and the output:
Priority Mins MissFlg
Critical 3 0
Critical 40 0
Critical 70 0
High 50 NC
For the 3rd row the MissFlg should evaluate to 1, as no of Mins is greater than 60, but it doesn't work.The outer If appears to work though(per the resilut in 4th row).
Could you please help?
Note: The MIns is a filed calculated from an earlier calculation which holds minutes difference between 2 timestamps.
Thanks all for your time!!
I used the Num# and it works!
If(Priority= 'Critical',if(Num#(Mins)>60,1,0),'NC') as MissFlg
Try with:
If(Priority= 'Critical',if(Num(Mins)>60,1,0),'NC') as MissFlg
Thanks Enrique for the quick turn.
I tried the Num function, but it didnt work.
I changed the condition as:
If(Priority= 'Critical',if(Mins>0,1,0),'NC') as MissFlg
and it did work for Mins which are greater than 0, but when I change it to non-zero, it appears it doesn't work.
I had just copied the part of code for better understanding, now I am copying the entire code incase if it helps:
if(Project='ABC',
If(Priority= 'Critical',if(Mins>60, 1,0),if(Priority='High', if(Mins>300,1,0),if(Priority='Medium', if(Mins>2880,1,0),if(Priority='Low', if(Mins>4320,1,0),'Not Priortized')))),
if(Project='XYZ',
If(Priority= 'Critical',if(Mins>60, 1,0),if(Priority='High', if(Mins>300,1,0),if(Priority='Medium', if(Mins>2880,1,0),if(Priority='Low', if(Mins>4320,1,0),'Not Priortized')))),'NA')) as MissFlg
The script given below generates the output shown below:
LOAD *,If(Priority='Critical',If(Mins>60,1,0),'NC') as MissFlag;
load * Inline [
Priority,Mins
Critical,3
Critical,40
Critical,70
High,50
];
Thanks all for your time!!
I used the Num# and it works!
If(Priority= 'Critical',if(Num#(Mins)>60,1,0),'NC') as MissFlg