Hi,
I am trying to do a fuzzy search on a CDT field which is a string array. The array is { "One"; "Five"; "Seven"; "Ten" }.
Input:
{"Five","Seven"}
Output:
Array of all those CDT items where we have {"Five"} and {"Seven"} and ("Five","Seven")
Please help me with it.
Discussion posts and replies are publicly visible
Did you try whereContains()? It will give you the indexes in the larger array that contain any members of the smaller array.
Are you looking across a list of lists or across a single list? wherecontains() should work for a single list but you might need something a bit more fancy if you want to compare across multiple lists, like this:
a!localVariables( local!data: { a!map(id: 1, items: {"One","Two","Three"}), a!map(id: 2, items: {"One","Two",}), a!map(id: 3, items: {"Two","Four"}), a!map(id: 4, items: {"Three"}) }, where( a!forEach( items: local!data, expression: sum(wherecontains({"One", "Three"},touniformstring(fv!item.items))) ) ) )