Concat Multiple Checkboxes While Filtering Duplicates
This is a solution to find only the unique checkbox choices with the custom JavaScript pipe.
Step 1
Install the Custom JavaScript pipe, and add the parameters as shown in the image below. Feel free to add more values or remove them.
Step 2
In the Request tab of the pipe, add the following code. If you added or removed values in step 1, change the values in the request here.
Array.prototype.contains = function(v) {
for (var i = 0; i < this.length; i++) {
if (this[i] === v) return true;
}
return false;
};
Array.prototype.unique = function() {
var arr = [];
for (var i = 0; i < this.length; i++) {
if (!arr.contains(this[i])) {
arr.push(this[i]);
}
}
return arr;
}
var concatAll = "{value1}" + ',' + "{value2}" + ',' + "{value3}" + ',' + "{value4}" + ',' + "{value5}";
var duplicatesArray = concatAll.split(',');
var uniques = duplicatesArray.unique();
uniques.toString().replace(/,/g, ", ");
Step 3
Configure the pipe in your table rules to run when the record is created or edited, as seen in the image below.
We'd love to hear your feedback.