Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Kind of runnig, cumulative or range match in LOAD SCRIPT

Hi!

I'm so confused with the solution for the scenario below for a Load Script:

load * Inline [

ID,COD

1,A

1,B

1,C

2,B

2,D

3,A

4,A

4,C

4,D

];

As you can see there are IDs and CODs.

I need que match all IDs where the COD matches A and C values (MATCH CHECK field).

ID
COD
MATCH CHECK
1AYES
1BYES
1CYES
2BNO
2DNO
3ANO
4AYES
4CYES
4DYES

I tried combining peek and match or wildmatch functions but I cannot find the way to do this.

I'll appreciate any help with this.

Let me know if you need some other explanation.

Thanks,

Lander

15 Replies
Anonymous
Not applicable
Author

Sunny, Tamils response doesn´t wor in my real environment.

Let me specify that the real codes look like C03CA02 or C03XA01.

A


So the more realistic load inline should seem like


Table:

LOAD * Inline [

ID,COD

1,N05BA06

1,N06AX11

1,A01AB03

2,N06AX11

2,C08CA01

3,N05BA09

4,N05AX13

4,C09CA02

4,N06AX11

];


And I need to find those ID with CODs started by 'N05*' or 'N06A' and add the value YES to the new field [MATCH CHECK]

tamilarasu
Champion
Champion

Hello Lander,

Below method works fine.

Data:
load * Inline [
ID,COD
1,N05BA06
1,N06AX11
1,A01AB03
2,N06AX11
2,C08CA01
3,N05BA09
4,N05AX13
4,C09CA02
4,N06AX11
]
;

Left Join
Load ID,
If(WildMatch(Concat(COD, '|'), '*N05*N06A*'),'Yes','No') as [Match Check]
Resident Data Group by ID;

Anonymous
Not applicable
Author

Thanks Tamil, I´m working on it between the solutions given by both you and Sunny.

I'm telling you something as soon as possible.

tamilarasu
Champion
Champion

Sure. Take your time.

sunny_talwar

In addition to what Tamil provided, this also works:

Table:

LOAD * Inline [

ID,COD

1,N05BA06

1,N06AX11

1,A01AB03

2,N06AX11

2,C08CA01

3,N05BA09

4,N05AX13

4,C09CA02

4,N06AX11

];

Join (Table)

LOAD ID,

  If(Count(If(WildMatch(COD, 'N05*', 'N06A*'), COD)) = 2, 'YES', 'NO') as [MATCH CHECK]

Resident Table

Group By ID;


Capture.PNG

Anonymous
Not applicable
Author

Hi guys!

This is just for confirming that your logic is correct.

I actually have used both two options depending on the check with i had to work.

Then, with the combination of the results on each column resulting on your logic I was able to finish what I wanted.

Thanks a lot!

Let know if need some more information.

Lander