Skip to main content
Solved

Inner join between attachment url

  • December 14, 2022
  • 2 replies
  • 25 views

Forum|alt.badge.img+16

Hi, I'm trying to do an inner join between two columns and print in a new column (only the attachments that are in common in both columns). The problem is that the columns have attachment URLs, I tried to use the Script that @Andrey_Kovalev  suggested to me for just text, but it just prints me the first element or anything. 

 

Those are the two columns that I'm trying to merge (Total Primary and Total 2). 

Total primary is: 

and Total 2 is: 

This is the result that I obtained: 

For example Sara should have Test 3 and Test 1, but She has only Test 1.

This is the code that I tried to use with automation:

 

//collect input let Rec = input.config() //load records let table = base.getTable("Users") let record = await table.selectRecordAsync(Rec.RecID) //declare inner join array let innerJoin2 = [] //function for filtering unique array entries function onlyUnique(value, index, self) { return self.indexOf(value) === index; } //check existence of the record and not empty arrays if(record !== null && record.getCellValueAsString("Total Primary") !== "" && record.getCellValueAsString("Total 2") !== "") { //variables declaration let array3 = record.getCellValueAsString("Total Primary").split(",") let array4 = record.getCellValueAsString("Total 2").split(",") //check if entries of array3 exist in array4 for(let entry of array3){ if(array4.includes(entry)){ innerJoin2.push(entry) } } //filter unique array entries innerJoin2 = innerJoin2.filter(onlyUnique) //update InnerJoin field with contents of innerJoin array await table.updateRecordAsync(Rec.RecID, { "innerJoin2": innerJoin2.toString() }) }

 

 

 

 

What did I do wrong 😰?  Thank you very much for any help! 

Best answer by Andrey_Kovalev

@Sara11 , I can see that in your example a comma is missing between Test 2 and Test 3 links. That is why Test 3 can not be distinguished as an array entry. The array looks like [Test 1, Test 2 Test 3, Test 1].

2 replies

Andrey_Kovalev
Forum|alt.badge.img+20
  • Inspiring
  • 95 replies
  • Answer
  • December 16, 2022

@Sara11 , I can see that in your example a comma is missing between Test 2 and Test 3 links. That is why Test 3 can not be distinguished as an array entry. The array looks like [Test 1, Test 2 Test 3, Test 1].


Forum|alt.badge.img+16
  • Author
  • Inspiring
  • 89 replies
  • December 19, 2022

@Sara11 , I can see that in your example a comma is missing between Test 2 and Test 3 links. That is why Test 3 can not be distinguished as an array entry. The array looks like [Test 1, Test 2 Test 3, Test 1].


Thank you very much!! That was the problem!