Join two times same array, how?

Hi guys, I am facing a hard time here with array and need some help.

Basically what I am trying to do is to join 2 arrays, but here is a little bit more complicated because I have 2 ids on arr2, and the id in arr1.


arr1 I have the "id" and I need the "name" value.

arr2 I have "time_a" and "time_b", wich are 2 unique ids.

the challenge here is: How to join 2 times and bring the "name" from arr1 FOR "time_a" and "time_b"

I have done the 1 time join already and it looked like this.

msg.teamsTbl = global.get('teamsTbl')
msg.matchesTbl = global.get('matchesTbl')
let arr1 = msg.teamsTbl
let arr2 = msg.matchesTbl
let merged = [];
for (let i = 0; i < arr1.length; i++) {
        ...(arr2.find((itmInner) => itmInner.time_a === arr1[i].id))
msg.merged_a = merged
return msg;

Now I need to do another join, bringing the id again, but getting stuck.

Any Ideas? Thanks!

Can you post a short example of both incoming arrays and the expected output ?

Sure, im limited to post pics, but I'll try my best hahha

I hope my explanation is better now, thanks!

I managed to do it, renaming the "id" "abrv" and "name" column to their respective name + _A

and I re-joined the arrays renaming another results to their respective names + _B


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.