Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi
I want to write an if condition to meet following criteria
Range No Value Range
1 between 10000 to -10000
2 between 10001 to 25000 or -10001 to -25000
3 between 25001 to 50000 or -25001 to -50000
Pls help me to write a script (if) for following values to fall with given range no
Value Range No
10000 1
-8000 1
15000 2
-11000 2
-50000 3
... or maybe use the Fabs() function :
Temp :
LOAD * INLINE [
Value
10000
-8000
15000
-11000
-50000
];
Data:
load
if ( FabsValue <= 10000 , 1 ,
if ( FabsValue <= 25000 , 2 ,
if ( FabsValue <= 50000 , 3 , ))) as [Range No] ,
*
;
load
Fabs(Value) as FabsValue ,
Value
resident Temp
;
drop table Temp ;
Hi,
Try this script
A:
LOAD * INLINE [
Value
10000
-8000
15000
-11000
-50000
];
NoConcatenate
B:
Load Value,
if(Value>=-10000 and Value<= 10000, 1,
if((Value>=10001 and Value<=25000) or (Value<=-10001 and Value>=-25000),2,
if((Value>=25001 and Value<=50000) or (Value<=-25001 and Value>=-50000),3))) as [Range No]
Resident A;
drop table A;
... or maybe use the Fabs() function :
Temp :
LOAD * INLINE [
Value
10000
-8000
15000
-11000
-50000
];
Data:
load
if ( FabsValue <= 10000 , 1 ,
if ( FabsValue <= 25000 , 2 ,
if ( FabsValue <= 50000 , 3 , ))) as [Range No] ,
*
;
load
Fabs(Value) as FabsValue ,
Value
resident Temp
;
drop table Temp ;
Your answer is also correct. But Bills logic is very easy
Thanks