Hi all 🙂
I'm trying to link two tables based on one of two conditions, but am not sure if it works with simple automations or if it requires a script (I'm also new to scripting). I have the following two tables:
TABLE 1 contains (amongst other information) vendor IDs that are either the simple IDs or a combination of ID and city code, example:
ID |
100009 |
100014CGN |
100014BON |
TABLE 2 contains each vendor and the recipient, for example:
Vendor ID | Recipient | Key |
100009 | BER1 | 100009BER |
100009 | BER2 | 100009BER |
100014 | CGN1 | 100014CGN |
100014 | CGN2 | 100014CGN |
100014 | BON | 100014BON |
Now, I would like to link the tables under the following conditions:
1. If the Key in TABLE2 is available as an ID in TABLE1, the records should be linked
2. If the Key in TABLE2 is not available as an ID in TABLE1, but the vendor ID in TABLE2 is available as an ID in TABLE1, the records should be linked via the vendor ID
3. If none is available, there should not be any link
I tried linking it with two different automations, but the automations would just create new records (e.g., 100009BER is not available in TABLE1, so the automation would create that record there).
Any help would be much appreciated! Thank you 😊