Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
vipin_mishra479
Creator II
Creator II

Issue at script level

Hi All,

I have 1 table where field like this

Entity IdResultEntitySEQNO
E123FailedA1
E123FailedB2
E123FailedC3
E123FailedD4
E123PassE5
E123PassF6
E123FailedG7
E123FailedH8
E123FailedI9

for this table i want only failed result SEQNO and store that SEQNO in 1 variable

like vVariable  = '1','2','3','4','7','8','9'

than i want pass that variable value in another table

like where wildmatch(SEQNO,$(vVariable))

Please suggest me how can i store that variable in script level and  pass that variable in script level

Labels (1)
1 Solution

Accepted Solutions
phaneendra_kunc
Partner - Specialist III
Partner - Specialist III

Try these....

Solution 1 - Variable

TableXYZ:

Load Concat(Distinct SEQNO,',') as Var_SEQNO From TableXYZ Where Result = 'Failed';

Let vVariable = Peek('Var_SEQNO',0,TableXYZ);


Solution 2 - Where Exists


Failed_SEQ:

Load SEQNO as FailedSEQ From TableXYZ Where Result = 'Failed';  //======Either this can be FROM or RESIDENT


While loading another table use "Where Exists"

TablePQR:

Load * From TablePQR where exists (FailedSEQ,SEQNO);

View solution in original post

6 Replies
phaneendra_kunc
Partner - Specialist III
Partner - Specialist III

Try these....

Solution 1 - Variable

TableXYZ:

Load Concat(Distinct SEQNO,',') as Var_SEQNO From TableXYZ Where Result = 'Failed';

Let vVariable = Peek('Var_SEQNO',0,TableXYZ);


Solution 2 - Where Exists


Failed_SEQ:

Load SEQNO as FailedSEQ From TableXYZ Where Result = 'Failed';  //======Either this can be FROM or RESIDENT


While loading another table use "Where Exists"

TablePQR:

Load * From TablePQR where exists (FailedSEQ,SEQNO);

jagan
Partner - Champion III
Partner - Champion III

Hi,

Try like this

Data:

LOAD

Concat(Distinct SEQNO,',') as FailedSeqNo

FROM DataSource

WHERE Result = 'Failed';

Let vFailedSeqNo = Peek('FailedSeqNo',0,Data);

DROP TABLE Data;

Hope this helps you.

Regards,

Jagan.

jcoggon
Partner - Contributor III
Partner - Contributor III

Hi Vipin,

Phaneendra's solution would work with a few tweaks as below:

TABLE1:

LOAD

[Entity Id],

Result,

Entity,

SEQNO

FROM TABLE1

ConcatTable:

NoConcatenate

LOAD Distinct Concat(SEQNO,',') as Var_SEQNO

Resident TABLE1

WHERE Result = 'Failed';

Let vVariable = FieldValue('Var_SEQNO',1);

DROP TABLE ConcatTable;

TABLE2:

NoConcatenate

LOAD *

Resident TABLE1

WHERE wildmatch(SEQNO,$(vVariable));


DROP TABLE TABLE1;

Not applicable

Main:

LOAD [Entity Id],

     Result,

     Entity,

     SEQNO

FROM

Book1.xlsx

(ooxml, embedded labels, table is Sheet1);

Temp:

LOAD Concat(SEQNO,',') as seq Resident Main Where Result='Failed';

let vSeq = peek('seq',0,Temp);

EXIT Script;

vipin_mishra479
Creator II
Creator II
Author

Thanks to all its working fine

neha_sri
Creator III
Creator III

Hi Vipin,

I think you can calculate the seq no at backend and then use it.

Load

[Entity Id],

    
Result,

    
Entity,

    
SEQNO,

    
if(Result='Failed',SEQNO)   as Updated_seq

Regards,

Neha