Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have set of data. And these data must go through different multiple tests with different conditions. Is there a way to loop around? Now I have used concatenate load with different conditions. Say I have 10 tests and I have taken 10 resident concatenate loads to tackle this. is there a better option around?
Can you share your script?
Can you be more specific with sample data
Possibly - but its impossible to give you specific help without a lot more information
hi,
please post sample data,so can help
TestData:
LOAD * INLINE [
Nums, Country
1,India
0,US
6,China
5,Russia
-6,Japan
-2,UK
];
Exceptions:
LOAD
Nums,
Country,
IF(Nums<0,'Has negative values','OK') as [Error type]
RESIDENT TestData;
CONCATENATE LOAD
Nums,
Country,
IF(Nums=-2,'Has -2 value','OK') as [Error type]
RESIDENT TestData;
CONCATENATE LOAD
Nums,
Country,
IF(Nums=0,'Has 0 value','OK') as [Error type]
RESIDENT TestData;
CONCATENATE LOAD
Nums,
Country,
IF(Country<>'US','Non-US Country','OK') as [Error type]
RESIDENT TestData;
DROP TABLE TestData;
I have shared some sample data.If a record has the possibility of all 4 Error Type, then it must be duplicated with the correct error type. Is it possible to do the same in a loop without using nested if blocks for all error types?
Try this:
TestData:
LOAD
Nums,
Country,
IF(Nums=-2,'Has -2 value',If(Nums<0,'Has negative values',If(Nums=0,'Has 0 value',IF(Country<>'US','Non-US Country','OK')))) as [Error type];
LOAD * INLINE [
Nums, Country
1,India
0,US
6,China
5,Russia
-6,Japan
-2,UK
];
Sorry i misunderstood the question
hi,
may be try:
PICK(Match(Nums,''<0','0','-2','>0'),'Has Negative values', 'Has 0 values','Has -2 values','OK ') as ErrorType