Hi @Mariusz_S - from your description, your set-up is like this, yes?


And you want to end up like this:

Your script works 100% on my base, so this suggests that there are some differences in the matching Application ID values, i.e. they look the same but maybe are different (space at the end for example). Or maybe there are some Applications IDs that are in one table but not in the other.
As an aside, the naming here is a bit confusing:
let cmpTbl = base.getTable("Contacts");
let cntTbl = base.getTable("Companies");
Feels like the identifiers should be the other way around, but this isn’t why the script isn’t working.
Hi @Mariusz_S - from your description, your set-up is like this, yes?


And you want to end up like this:

Your script works 100% on my base, so this suggests that there are some differences in the matching Application ID values, i.e. they look the same but maybe are different (space at the end for example). Or maybe there are some Applications IDs that are in one table but not in the other.
As an aside, the naming here is a bit confusing:
let cmpTbl = base.getTable("Contacts");
let cntTbl = base.getTable("Companies");
Feels like the identifiers should be the other way around, but this isn’t why the script isn’t working.
Hi @JonathanBowen,
yes that’s exactly how the base is structured.
There’s like 60 records that remain unmatched.
The behaviour is odd as it clearly was able to find a match for one contact but not the other?

Hi @JonathanBowen,
yes that’s exactly how the base is structured.
There’s like 60 records that remain unmatched.
The behaviour is odd as it clearly was able to find a match for one contact but not the other?

Yes, it looks like it should match, but clearly it isn’t doing that. This is where I think they might be subtly different, e.g. one has an additional space at the start or end - sometimes it is hard to spot this in the UI.
What you can do is, on your inner loop remove the if
statement and just replace with:
console.log(cntRecord.getCellValue("Application ID"), cmpid)
so you’re not testing for equality here, but just logging out the two values - I find that this sometimes highlights data issues.