Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello Experts,
I am confused on the logic of "Where Exists" when using at a Concatenated Field.
My scenario is to load the matching fields of Field_1 and Field_2 of Table_B to Table_A;
So, the expected value from Table_B is to load only Filed_1 's Value "A" and Filed_2's Value "1" using Where exists statement.
Like below example:
Table_B:
Filed_1 | Filed_2 | Filed_4 |
A | 1 | 456 |
However, When I am using the attached Script_1.txt, the results are wrong by loading all the values of from Table_B.
In Other Case, If I use a Single Field for Where Exits, it is producing correct results.
Below is the script and Its result.
Script:
Result:
Experts, please help how to resolve.
Thank you!
At the Field time you are using exsists() you have already loaded A3 and B1 into the datamodel as you load the table Table_B_Final.
Try moving the exists statement up to that Load statement instead.
Table_A:
Load * Inline [
Field_1,Field_2,Field_3
A,1,001
A,2,003
B,3,005
];
NoConcatenate
Table_A_Final:
Load
Field_1&Field_2 as Field_1andField_2,
Field_3
Resident Table_A;
Drop table Table_A;
Table_B:
Load * Inline [
Field_1,Field_2,Field_4
A,1,456
A,3,567
B,1,789
];
NoConcatenate
Table_B_Final:
Load
Field_1&Field_2 as Field_1andField_2,
Field_4
Resident Table_B
where Exists(Field_1andField_2,Field_1&Field_2)
;
Drop Table Table_B;
At the Field time you are using exsists() you have already loaded A3 and B1 into the datamodel as you load the table Table_B_Final.
Try moving the exists statement up to that Load statement instead.
Table_A:
Load * Inline [
Field_1,Field_2,Field_3
A,1,001
A,2,003
B,3,005
];
NoConcatenate
Table_A_Final:
Load
Field_1&Field_2 as Field_1andField_2,
Field_3
Resident Table_A;
Drop table Table_A;
Table_B:
Load * Inline [
Field_1,Field_2,Field_4
A,1,456
A,3,567
B,1,789
];
NoConcatenate
Table_B_Final:
Load
Field_1&Field_2 as Field_1andField_2,
Field_4
Resident Table_B
where Exists(Field_1andField_2,Field_1&Field_2)
;
Drop Table Table_B;
The where exists is looking at all previously loaded values in Field_1andField_2,
which are
A1 (from Table_A_Final)
A2
B3
A3 (from Table_B_Final)
So the last table will bring in all the fields from Table_B_Final.
B1