Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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 |
---|---|---|
1 | A | YES |
1 | B | YES |
1 | C | YES |
2 | B | NO |
2 | D | NO |
3 | A | NO |
4 | A | YES |
4 | C | YES |
4 | D | YES |
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
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?
That's correct
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;
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;
Thanks Sunny T but i´m afraid that the solution should be more dynamic.
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
Is Tamil's response satisfied your requirement? If not, please elaborate on how you want to make this dynamic?
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.
I guess elaborate on your concerns from my and Tamil's solution and we might be able to offer better advice to you.