Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

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
Valued Contributor III

Re: Loop Data for multiple tests

Can you share your script?

qlikmsg4u
Valued Contributor

Re: Loop Data for multiple tests

Can you be more specific with sample data

MVP
MVP

Re: Loop Data for multiple tests

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
neetha_p
Honored Contributor

Re: Loop Data for multiple tests

hi,

please post sample data,so can help

Not applicable

Re: Loop Data for multiple tests

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
Valued Contributor

Re: Loop Data for multiple tests

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

neetha_p
Honored Contributor

Re: Loop Data for multiple tests

hi,

may be try:

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

Community Browser