Skip to main content
New Participant
January 6, 2021
Question

Search value from one List of Text String to another List of Text String.

  • January 6, 2021
  • 3 replies
  • 0 views

Hi All,

I need to find the common values from one List of Text String to another list of string .

I have tried to use foreach but still there is no luck  !

    3 replies

    csteward
    Brainy
    January 6, 2021

    The union() function will achieve this for you:

    a!localVariables(
      local!listA: {"221465","221446","221233","220867","221277"},
      local!listB: {"221465","221446","221233","220867","221277","221485","221446","221203","220867"},
      
      union(local!listA,local!listB)
    )

    peter.lewis
    Participating Frequently
    January 7, 2021

    I don't think the union() is the correct solution here - union() combines the lists together to return all the items. From the phrasing of the question, it sounds like you want the values that exist in both text strings. If that's the case, the intersection() function should give you what you need.

    csteward
    Brainy
    January 7, 2021

    Totally correct sir!  Pardon my hasty reply.

    a!localVariables(
      local!listA: {"221465","221446","221233","220867","221277"},
      local!listB: {"221465","221446","221233","220867","221277","221485","221446","221203","220867"},
    
      intersection(local!listA,local!listB)
    )