Skip to main content
Question

Find position of text string in larger string

  • September 16, 2020
  • 0 replies
  • 283 views

I have a long string in my Services table, the result of a Combined Text Summary field, each element takes the pattern V###-#### (where the number parts of the string are arbitrary length). For example :
V102-136 ; V23-4072 ; V8-25
I want to create a formula which extracts correct element in this array, based on the value in another field, and I could do it if I knew the position in the text string of the "V" value. So if there were a function Find which returned the position of a text string, that would do it. Something like
Find([Summary Field", "V" & [Text string to search for])
I can't find a function to do this. Functions like left just search for single characters, and I need to search for a longer string. Ideas?

------------------------------
Jonathan Heuer
------------------------------
This topic has been closed for replies.

MarkShnierYou
Forum|alt.badge.img+22
  • Quickbase Alumni
  • September 16, 2020

I would approach this differently. I would use the part function in QuickBase to isolate the different elements and then use a case function to determine the result.

var text value = totext([my multi select field]);

var text A = Trim(Part($value,1,";"));
var text B =Trim(Part($value,2,";"));
var text C = Trim(Part($value,3,";"));
etc
var text Z = Trim(Part($value,26,";"));


Case([value in another field]),
1, "$A,
2, $B,
3, $C,
etc

26, $Z)



------------------------------
Mark Shnier (YQC)
Quick Base Solution Provider
Your Quick Base Coach
http://QuickBaseCoach.com
mark.shnier@gmail.com
------------------------------

  • Quickbase Alumni
  • September 16, 2020
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
------------------------------