Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hey everyone,
I need to do a multiple lookup between two tables.
Let me show
Table1:
| Data | Fabricante | Provedor | 
| 01/04/2023 | Randon | OEM | 
| 01/05/2023 | Librelato | IBERO | 
| 01/06/2023 | Sergomel | SUSPENSYS | 
| ... | ... | ... | 
| 01/11/2023 | Librelato | SUSPENSYS | 
| 01/12/2023 | Sergomel | IBERO | 
As we can see, Librelato and Sergomel changed their values.
Table2:
| Data | Estado | Município | Fabricante | Produto | Total | Provedor | 
| 01/04/2023 | SC | Itajaí | Randon | ... | x | Value needed | 
| 01/05/2023 | SP | São Paulo | Librelato | ... | y | Value needed | 
| 01/06/2023 | SP | São Paulo | Sergomel | ... | z | Value needed | 
| ... | ... | ... | Value needed | |||
| 01/11/2023 | MG | Belo Horizonte | Librelato | ... | w | Value needed | 
| 01/12/2023 | RS | Porto Alegre | Sergomel | .... | x | Value needed | 
i need to do a lookup with two criteria
You can create a mapping table with Table1 concatenating Data and Fabricante, something like this:
mapProvedor:
Load Text(Data)&'@'&Fabricante as Key, Provedor as Value Resident Table1;
Then when loading Table2, you can do:
...
ApplyMap('mapProvedor',Text(Data)&'@'&Fabricante) as Provedor
...
You can create a mapping table with Table1 concatenating Data and Fabricante, something like this:
mapProvedor:
Load Text(Data)&'@'&Fabricante as Key, Provedor as Value Resident Table1;
Then when loading Table2, you can do:
...
ApplyMap('mapProvedor',Text(Data)&'@'&Fabricante) as Provedor
...
Very very good.
It changed all my script. Much more simple now.
Thanks!