Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
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
tamilarasu
Champion
Champion

Hi Lander,

If same ID contains A or C in COD Field then you need to mention the MATCH CHECK as "Yes" else "No". Right?

Anonymous
Not applicable
Author

That's correct

sunny_talwar

May be this:

Table:

LOAD * Inline [

ID,COD

1,A

1,B

1,C

2,B

2,D

3,A

4,A

4,C

4,D

];

Join (Table)

LOAD ID,

  If(Count(If(Match(COD, 'A', 'C'), COD)) = 2, 'YES', 'NO') as [MATCH CHECK]

Resident Table

Group By ID;


Capture.PNG

tamilarasu
Champion
Champion

You can try,

Data:
load * Inline [
ID,COD
1,A
1,B
1,C
2,B
2,D
3,A
4,A
4,C
4,D
]
;

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

Untitled.png

Anonymous
Not applicable
Author

Thanks Sunny T but i´m afraid that the solution should be more dynamic.

Anonymous
Not applicable
Author

Thanks Tamil, your point of view is interesting.

I need to translate this solution to my real environment.

I will let you know about this asap.

Lander

sunny_talwar

Is Tamil's response satisfied your requirement? If not, please elaborate on how you want to make this dynamic?

Anonymous
Not applicable
Author

I´m afraid it doesn't work for my model, Tamil.

My real codes are longer than a capital letter, so your solution seems not be the best for that case.

sunny_talwar

I guess elaborate on your concerns from my and Tamil's solution and we might be able to offer better advice to you.