Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
hi all
I want to set variable by using For Loop based on Customer field from Source Table,
Source:
LOAD Customer,
Product
FROM
for loop starting here for every customer
selectedcustomer:
LOAD Customer as selectedcustomer,
Product
Resident Source Where Customer = ' Dynamically Change Customer Variable';
ExcludeCustomer:
LOAD Customer as ExcludeCustomer,
Product
Resident Source Where Customer <> 'Dynamically Change Customer Variable';
you are taking Variable and same time you are joining to each table and excluding the same variable. I am not sure i followed you
Hi Vengadesh,
Instead of all that looping why not:
Mappingselected:
Mapping
LOAD
Autonumber(Customer & '|' & Product,'SelectedID'),
'Selected Customer'
FROM
Test.xlsx
(ooxml, embedded labels);
Cross:
Load
Distinct
Customer
FROM
Test.xlsx
(ooxml, embedded labels);
Outer Join(Cross)
Load
Distinct
Product
FROM
Test.xlsx
(ooxml, embedded labels);
Final:
Load
ApplyMap('Mappingselected',Autonumber(Customer & '|' & Product,'SelectedID'),'Excluded Customer') as Status,
*
Resident Cross;
Drop table Cross;
Product | Customer | C1 | C2 | C3 | C4 |
---|---|---|---|---|---|
A | Selected Customer | Selected Customer | Selected Customer | Excluded Customer | |
B | Selected Customer | Selected Customer | Selected Customer | Excluded Customer | |
C | Selected Customer | Selected Customer | Excluded Customer | Excluded Customer | |
D | Selected Customer | Selected Customer | Excluded Customer | Excluded Customer | |
E | Selected Customer | Excluded Customer | Excluded Customer | Excluded Customer | |
F | Selected Customer | Excluded Customer | Excluded Customer | Excluded Customer | |
G | Selected Customer | Excluded Customer | Excluded Customer | Selected Customer | |
H | Selected Customer | Excluded Customer | Excluded Customer | Selected Customer | |
I | Selected Customer | Excluded Customer | Excluded Customer | Excluded Customer | |
J | Excluded Customer | Selected Customer | Selected Customer | Excluded Customer | |
K | Excluded Customer | Selected Customer | Excluded Customer | Selected Customer | |
L | Excluded Customer | Excluded Customer | Excluded Customer | Selected Customer | |
M | Excluded Customer | Excluded Customer | Excluded Customer | Selected Customer | |
O | Excluded Customer | Excluded Customer | Selected Customer | Excluded Customer | |
Z | Excluded Customer | Excluded Customer | Excluded Customer | Selected Customer |
Regards
Andrew
Ok Anil
I removed join
My question is i have field Customer by using customer i want to perform some action for every customer so i want to add for loop
Hi vengadesh,
it's not clear what result you are expecting.
Instead of describing the solution (which you are obviously struggling with, hence posting on here), why don't you illustrate the output you are looking for.
Marcus