I have an array column [Apple, Apricot, Apricot]. Below I am showing using joined list.
The second column (Read Food to remove) are food i want to remove form the first column. I realise that using the unique elements computed column will instead remove both Apricot from the list.
My desired output is to remove only 1 Apricot based on the (Food to remove) column.
Any advice?
Hi @Trustin,
Did I got you correctly?

Also maybe with some js :
function removeItemFromCSV(csvString, itemToRemove) {
const values = csvString.split(',');
let removed = false;
const updatedValues = values.filter((value) => {
if (value.trim() === itemToRemove && !removed) {
removed = true;
return false;
}
return true;
});
return updatedValues.join(', ').trim();
}
const csvString = p1;
const itemToRemove = p2;
const result = removeItemFromCSV(csvString, itemToRemove);
return result;
Thank you
2 Likes
Here is another JavaScript option that is slightly less verbose:
const arr = p1.split(', ');
const index = arr.indexOf(p2);
if (index != -1) {
arr.splice(index,1);
return arr.join(', ');
}
return p1;
4 Likes
Yes. Time to deploy some javascript! Thanks! #WelcometotheNocodecodingclub lol
4 Likes
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.