Parsing Text: How to do advanced "split by" and "items until" and "sum"

Hello, I am attempting to calculate the sum of the first three items from a comma-delimited text field of multiple records.

What I have:
A Data Type called “Tracking” with a text field named “Score”

Record 1: Field (“Score”) = 1,0,1,1,1,1,0
Record 2: Field (“Score”) =1,0,0,0,0,0
Record 3: Field (“Score”) = 1,1,1,1,1,1,1

What I want:
The sum of the first three values from each record.

1,0,1 = 2
1,0,0 =1
1,1,1 = 3

So I want the total sum, which would be 2+1+3 = 6

I’ve attached a screenshot of my attempted query.

Any help would be appreciated! Thanks!

Hi there, @jacobjanderson… I came up with and tested this expression, and it seems to do what you described.

Hope this helps.


1 Like

@mikeloc - Thank you so much, that really helped (i.e. it works!) I am just exposing myself to Regex, so would never have known how to do this. It is weird that the Bubble functions I was using weren’t working. Oh well.

For other no-coders who need help with Regex, I found this resource that helped me understand how @mikeloc solution worked.

Link: A simple tool that let’s you figure out how Regex works.

Thanks again Mike!

1 Like