Lists
Filter
14min
overview the filter action filters complex lists (data models or complex json objects) based on multiple criteria this documentation outlines the parameters, json configuration, and match types associated with the filter action parameters the filter action requires the following parameters input (required) list to filter ( list\<object> ) input (required) filter json configuration this entry will allow json output (required) filtered list ( list\<object> ) json configuration { 	"fieldmatches" \[ 	 { 	 "fieldname" "field1", 	 "matchtype" "exact", 	 "filterexpression" "expression", 	 "keepiftrue"\ true 	 }, 	 { 	 "fieldname" "field2", 	 "matchtype" "similar", 	 "filterexpression" "expression", 	 "keepiftrue"\ true 	 }, 	 { 	 "fieldname" "field3", 	 "matchtype" "fuzzy", 	 "filterexpression" "expression", 	 "fuzzyalgorithm" "levenstein", 	 "fuzzythreshold" 0 7, 	 "keepiftrue"\ true 	 }, 	 { 	 "fieldname" "field4", 	 "matchtype" "contains", 	 "filterexpression" "expression", 	 "keepiftrue"\ true 	 }, 	 { 	 "fieldname" "field5", 	 "matchtype" "soundex", 	 "filterexpression" "expression", 	 "soundexdistance" 4, 	 "keepiftrue"\ true 	 }, 	 { 	 "fieldname" "field6", 	 "matchtype" "similarwordmatch", 	 "filterexpression" "expression", 	 "similarfirstnwords" 1, 	 "similarlastnwords" 1, 	 "keepiftrue"\ true 	 }, 	 { 	 "fieldname" "field7", 	 "matchtype" "regex", 	 "filterexpression" "regex expression", 	 "keepiftrue"\ true 	 } 	], 	"alternatefields" \[ 	 { 	 "fieldname" "field1", 	 "fieldalternatenames" \["field2","field3"] 	 }, 	 { 	 "fieldname" "field3", 	 "fieldalternatenames" \["field4","field1","field2"] 	 } 	] } the json configuration for the filter action includes two main components fieldmatches and alternatefields matchtype types exact an exact match requires validation ( = ) against the specified filterexpression similar compares against filterexpression considering special characters for example, "john doe" and "john doe" are considered a match after removing special characters phone numbers e g , "376 323 1111" and "323 1111" are considered a match domain/url ignores prefixes like "www" or "http(s) //" email format matches emails with various representations like "@" or "\[at]" fuzzy utilizes algorithms from similarity search to compare fields against filterexpression more details here https //docs procesio com/how to/similarity search contains checks if filterexpression contains the field or vice versa soundex evaluates if two words are similar when spoken, based on a scale from 0 to 4 similarwordmatch compares the first or last n words in the field with those in filterexpression regex validates if the field matches the pattern specified in filterexpression the regex pattern must be json safe/encoded (e g by using test json encode online general php functions functions online https //www functions online com/json encode html ) properties fuzzyalgorithm & fuzzythreshold only used when matchtype = fuzzy if matchtype is something else, those properties will be ignored so, they can be null or can even not be present fuzzyalgorithm needs to be one from this here https //docs procesio com/how to/similarity search , written exactly as in the link provided fuzzythreshold is a double between 0 and 1, where 0 means any match is accepted and 1 requires 100% confidence soundexdistance used only when the matchtype = soundex and it can be set to 0, 1, 2, 3, or 4, where 4 means the words are very similar when spoken similarfirstnwords & similarlastnwords only used when matchtype = similarwordmatch in which case at least one should be >0 if both are =0 then the similarwordmatch will not be executed at all since it does not make sense if matchtype is something else, those properties will be ignored, so, they can have any value or can even not be present keepiftrue determines if the record should be kept based on the match criteria if set to true , the record will be retained the matching algorithms work only on fields that are of type primitive and not on data structures a row match is true only if all matches are true, so the evaluation looks like this (pseudo code for the json config from above) important if you have alternative fields for a match and the keepiftrue = true , then the match will be true if any ( at least one ) of the evaluations of the main or the alternative fields is true important if you have alternative fields for a match and the keepiftrue = false , then the match will be true if all of the evaluations of the main and the alternative fields are false alternatefields the alternatefields section specifies alternate fields for matching when evaluating a match for a certain field, the same match assessment will be executed for the alternate fields as well, and the result of all those alternate matches will be evaluated with or to determine the result of the overall match if fields1 has the alternate fields field2 & field3 does not mean that field2/field3 has field1 as an alternate field the matching algorithms work only on fieldname that are of type primitive and not on data structures a row match is true only if all matches are true