hi
in my app, I have array’s that have multiple text items in them, for example:
Array:
there is a cat
there is a dog
there is a bat
i want to query the array, or joined list and have it return a result, for example: “includes cat”
would return
“there is a cat”
this seems super basic and maybe i am just not understanding how to do it in glide. i don’t want to involve user inteface filtering, i need it in line with glide tables (not google sheets).
can someone point me in the right direction?
thank you!
hi Darren,
thank you for the fast response. I am actually in a good situation in that the array items/list items are all unique. so i don’t have to worry about duplicates or multiple matches…
hi
thank you for the response. this is close to what i am after, however, i need to be able to seek a partial word. for example:
array contents:
this cat is red
this cat is blue
this cat is pink
the lookup should check for red, and the response needs to be “this cat is red”
so i want to filter the array by the word red and respond with any array item that has the word red in it.
if that generates multiple responses, i.e. “the cat is red” and “the dog is red” that is perfectly fine…
I’m not sure there will be a simple way to do this using standard computed columns, but it’s easy enough with a bit of Javascript. The following should give the results that you describe:
var arr = p1.split(',');
var re = new RegExp(p2,'g');
var matches = [];
arr.forEach(function (item){
if (item.match(re)) {
matches.push(item);
}
});
return matches.join(',');
Darren, can’t thank you enough. that was awesome and worked perfectly.
I subbed out the * symbol in both the source joined list and the Java Script and I am getting the first match without issue. Should it be able to return more than one result? for example, if the Query was “this” can this approach respond with the “match multiple” style response and answer in a joined list?
thank you!!!