Thanks @Heather_Mann for your reply!
I initially tried this way, using the tagify1.values but it didn’t work!!
The reason is because in my case, I had ids(numbers) in my tagify but the JASON Array column content of my table was saved (from the default procedure) as Strings seperated with comma.
Tagify.values : [1,6,3]
JSON Array column: [“1”,“6”,“3”].
So, with the custom formatter I have built there was no match…
That’s why I tried to send them to server, split the tagify values and return them to client side in order to search for a match between two arrays of Strings.
By seeing you comparing the tagify.values I realised that there was something wrong there and figured out the only difference we had it was that… I had numbers (ids), you had strings.
So the new version of the custom dmx.Formatter is:
dmx.Formatter('array', 'existInArrays', function (arr1, arr2) {
var res = 0;
if (arr1 && arr1.length && arr2 && arr2.length) {
arr1 = arr1.map(String);
arr2 = arr2.map(String);
const output = arr2.filter(function (arr) {
res = res + ((arr1.indexOf(arr) !== -1) ? 1 : 0);
});
}
return res;
});
After I check that both arrays exist and have values, I turned them into strings.
So, now it is very easy to filter a query based on at least one of the tagify’s values.
And just in case somebody needs to match ALL the values (no matter the order of array items…) here is another custom dmx.Formatter:
dmx.Formatter('array', 'arraysAllMatch', function (arr1, arr2) {
var res = 0;
if (arr1 && arr1.length && arr2 && arr2.length) {
arr1 = arr1.map(String);
arr2 = arr2.map(String);
res = arr1.length === arr2.length && arr1.every(function (element) {
return arr2.indexOf(element) !== -1;
});
}
return res;
});