Forum Discussion
_anomDiebolt_
10 years agoQrew Elite
>The formula you provided works sometimes, but not all the time.
I have made this same mistake thinking that Right() and Left() will parse on multi-character strings rather than any one of the delimiter characters. This is a common mistake to programmers because most languages support this trivial text parsing feature as well as more advanced string manipulation methods and regular expressions.
I hesitate to provide this answer because this is trivial to do in JavaScript and the native QuickBase solution is a hack that is both cumbersome, promotes bad practices and has an upper limit to the number of tokens it could parse out.
But here is my solution that will attempt to parse the first seven S5* tokens:
List("\n",
If(Begins(Part(, 2, "S"), "5"), "S" & Left(Part(, 2, "S"), 4)),
If(Begins(Part(, 3, "S"), "5"), "S" & Left(Part(, 3, "S"), 4)),
If(Begins(Part(, 4, "S"), "5"), "S" & Left(Part(, 4, "S"), 4)),
If(Begins(Part(, 5, "S"), "5"), "S" & Left(Part(, 5, "S"), 4)),
If(Begins(Part(, 6, "S"), "5"), "S" & Left(Part(, 6, "S"), 4)),
If(Begins(Part(, 7, "S"), "5"), "S" & Left(Part(, 7, "S"), 4))
)
You can increase the number of tokens it will attempt to parse by adding additional lines using the obvious pattern of statements. You can use this text as a test case to see what I mean:
I HAVE SASSAFRAS AND BOXES OF S5442, S5443, S5444, S5445, S5446, S5447, S5448, S5449, S5450, S5451, S5452
FWIW, if you want a JavaScript solution you can adopt what is presented in this Q&A:
https://quickbase-community.intuit.com/questions/1193611-how-to-globally-replace-string-in-text-fiel...
I have made this same mistake thinking that Right() and Left() will parse on multi-character strings rather than any one of the delimiter characters. This is a common mistake to programmers because most languages support this trivial text parsing feature as well as more advanced string manipulation methods and regular expressions.
I hesitate to provide this answer because this is trivial to do in JavaScript and the native QuickBase solution is a hack that is both cumbersome, promotes bad practices and has an upper limit to the number of tokens it could parse out.
But here is my solution that will attempt to parse the first seven S5* tokens:
List("\n",
If(Begins(Part(
If(Begins(Part(
If(Begins(Part(
If(Begins(Part(
If(Begins(Part(
If(Begins(Part(
)
You can increase the number of tokens it will attempt to parse by adding additional lines using the obvious pattern of statements. You can use this text as a test case to see what I mean:
I HAVE SASSAFRAS AND BOXES OF S5442, S5443, S5444, S5445, S5446, S5447, S5448, S5449, S5450, S5451, S5452
FWIW, if you want a JavaScript solution you can adopt what is presented in this Q&A:
https://quickbase-community.intuit.com/questions/1193611-how-to-globally-replace-string-in-text-fiel...