Forum Discussion

richashubham's avatar
richashubham
Qrew Member
2 years ago

Matching text and text list

Hello Community, 
I am trying to match a text field with a text list formula field, by using the contains functions but it is not giving me an exact match. 
eg : if text list contains apple ; oranges and my text field is apple it is giving an exact match but even if i write app it will still give me a match.

Is there a better way to find the match? I want to tick a checkbox based on this match.



------------------------------
richa shubham
------------------------------
  • Use a query formula with "has"

    // the first half of the query {3.EX." & [Record ID#]  is there to limit the search to this record only
    //replace _fid with the field ID of the multi-select field and [Text Field] with the name of the text field
    var text qry = "{3.EX." & [Record ID#] &"} AND {_fid.has." & [Text Field] &"}";
    //size should only be able to return 0 or 1, so if it is 1 return true and check the checkbox
    Size(GetRecords($qry)) = 1


    ------------------------------
    Simon H
    ------------------------------
    • richashubham's avatar
      richashubham
      Qrew Member

      Hi Simon, 
      Thanks for your response, but it is still not working in the case for App. 
      if my list has apple, banana and my text field has Apples , it works perfectly but if i write App in my input field it is still returning 1.



      ------------------------------
      richa shubham
      ------------------------------
      • SimonH's avatar
        SimonH
        Qrew Cadet

        I just went back and tested again and you are correct. When using "HAS" with only a single element it does more of a "contains" type of match, i had used it with multiple elements where that wasn't the case.

        This would seem like incorrect behavior and doesn't quite match what the documentation states for the use of HAS so i would suggest opening a support ticket.



        ------------------------------
        Simon H
        ------------------------------