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
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]
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;
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.
Sure. Take your time.
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;
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