Skip to main content
March 21, 2023
Question

Find exact text and not contains

  • March 21, 2023
  • 8 replies
  • 0 views

Hello guys,

We're dealing it some issue on attempting this:

Right now with find() function or exact() you can't achieve the following:

Let's say we have an e-mail with this phrase "I am an idealist", and on the other hand we have a key defined as: "ideal", right now because the body considers all the text, if you try with find(), the output is true because it finds "ideal" on "am an [ideal]ist", and the exact() will not work as well because "am an idealist" is not the same as "ideal", even if the key was "idealist" it will output false as well.

Any ideas?

    8 replies

    stewart.burchell
    March 21, 2023

    Maybe it's too simplistic but aren't you looking for " ideal " rather than "ideal"? That is, the spaces either side of a word matter?

    mikes0011
    Brainy
    March 21, 2023

    I'm unclear exactly what it is you *are* looking for.  For instance are you looking for instances of " ideal " (i.e. with whitespace / non-word characters before and after, what we might call a "whole word" search elsewhere)?  Or is it something else?

    March 21, 2023

    Just check the java code bellow, basically we wanted to turn that into appian SAIL code.. but we can't find how we can do a foreach to compare local!corpo and !localcriterios.

    mikes0011
    Brainy
    March 21, 2023

    I'd start with

    whereContains(local!criterios, local!corpo)

    ...which will return an array of matches (indices in the 2nd array where value(s) from the 1st array are a match).  If no matches, the returned array will be empty.  You can do what you want from there with these results.

    The same result is attainable via a nested a!forEach (as long as you structure it right, i think your examples above are close but both miss the mark somewhat) - but whereContains() does this work for you.

    amans0009
    March 21, 2023

    you have to match key value word by word for the sentence , here is what you can do to resolve that  

    a!localVariables(
      local!text:"I am an idealist",
      local!key:"ideal",
      local!wordWiseSentance: split(local!text," "),
      contains(local!wordWiseSentance,local!key)
    )
    /*returns true means key is present else not present*/

    april.schuppel
    March 21, 2023

    There is a new plug-in called Similarity that may help. "The Text Similarity function plug-in allows users to compute a similarity score between pairs of texts. By computing a similarity score, one can find related items, group similar items, detect duplicates, and more."