Forum Discussion

Re: Find position of text string in larger string

If you only want to know if the summary field contains the value you are looking for (and don't need the index in the array), this should do it..
var text data = "V102-136 ; V23-4072 ; V8-25";
var textList dataList = Split($data, ";");
var text field = "V23-4072";
var bool hasField = Contains($dataList, $field);

If ($hasField, $field, "notfound")

------------------------------
Neil Schneider
------------------------------

6 Replies

  • JonathanHeuer's avatar
    JonathanHeuer
    Qrew Cadet
    Thanks Neil- yep I know about Contains. The problem is I need to extract the actual value from the text string, not just whether it's there or not.

    ------------------------------
    Jonathan Heuer
    ------------------------------
    • NeilSchneider's avatar
      NeilSchneider
      Qrew Cadet
      Jonathan,
      I probably misunderstood the question.  The formula field would return the actual value if the value is found in the string. The example returns "V23-4072", did you need the index of the value?

      ------------------------------
      Neil Schneider
      ------------------------------
      • JonathanHeuer's avatar
        JonathanHeuer
        Qrew Cadet
        Neil I'm sure I didn't clearly explain. Once I search for "V23" and obtain it's position, I'll ultimately want to get the value after the hyphen, "4072". But if I can find "V23" in the larger string, I'm fairly confident that I can extract the part after the hyphen.

        ------------------------------
        Jonathan Heuer
        ------------------------------