Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikWorld 2020: Join us May 11 - 14, 2020 in Phoenix, AZ. Register early and save $400. Learn More
honeyparpay
New Contributor III

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

Re: Kind of runnig, cumulative or range match in LOAD SCRIPT

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?

honeyparpay
New Contributor III

Re: Kind of runnig, cumulative or range match in LOAD SCRIPT

That's correct

Re: Kind of runnig, cumulative or range match in LOAD SCRIPT

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

Re: Kind of runnig, cumulative or range match in LOAD SCRIPT

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

honeyparpay
New Contributor III

Re: Kind of runnig, cumulative or range match in LOAD SCRIPT

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

honeyparpay
New Contributor III

Re: Kind of runnig, cumulative or range match in LOAD SCRIPT

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

Re: Kind of runnig, cumulative or range match in LOAD SCRIPT

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

Highlighted
honeyparpay
New Contributor III

Re: Kind of runnig, cumulative or range match in LOAD SCRIPT

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.

Re: Kind of runnig, cumulative or range match in LOAD SCRIPT

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