Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Loop Data for multiple tests

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?

7 Replies
senpradip007
Specialist III
Specialist III

Can you share your script?

qlikmsg4u
Specialist
Specialist

Can you be more specific with sample data

jonathandienst
Partner - Champion III
Partner - Champion III

Possibly - but its impossible to give you specific help without a lot more information

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Anonymous
Not applicable
Author

hi,

please post sample data,so can help

Not applicable
Author

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?

qlikmsg4u
Specialist
Specialist

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

];

Capture.PNG

Sorry i misunderstood the question

Anonymous
Not applicable
Author

hi,

may be try:

PICK(Match(Nums,''<0','0','-2','>0'),'Has Negative values', 'Has 0 values','Has -2 values','OK ') as ErrorType