Find(), Nth() and FormulaMap()

I was looking for a way to get all the positions in a list of a specific item, in this example the “&” using Find()


There are three “&” and I want to have the Ntht() position of each in this list.

My idea - based on the logic I picked up from Paul - to use something simple as


The result is that I have three times the first position and that is not what I had in mind.

Any suggestions or is Find() not the way to go?

thanks for insights. best christiaan

Hi @Christiaan_Huizer,
You might want to iterate throughout the string and check if the character matches.

Sequence(1, thisRow.all.Length()).
      WithName(pos, thisRow.all.Middle(pos,1).
      WithName(char,If(char=thisRow.binder, pos, "") )))

However, why you need to find the positions of all occurrences, if I may ask?

Usually this is for string replacements or some kind of similar transformation and Regex (RegexMatch/RegexReplace) are much more effective.

Please, do let me know if this helps.


hi @Federico_Stefanato !

Many thanks for the complicated and elegant (well structured!) solution. It is the first time for me I see an elegant application of the WithName(). Very instructive. I’ll use it next time as well in my formulas.

I do not a dev back ground, so I follow the instructions in the coda documentation and thought that via Find() we might be able to find all the positions of all the defined text, not only on the first position. But it seems I misunderstood the documentation since you neither applied Find().

The Why is indeed a good question. Before I solved my puzzle on how to get a list in a Row distributed over this and followong rows via AddOrModifyRows + extra functionalities I solved it differently. I concatenated all the relevant rows via ‘binder’, pushed this Row via AddRow to a next table to split this string later on.The splitting succeeded with a bit of secondary school math and I assumed that if I would have the position of each binder, I could easily calculate the start & end position in the Slice() with the help op Lenght(). So I looked for a solution via FInd / FormulaMap / Nth but did not succeed.

Would you advice me to start understanding RegexLMatch / RegexReplace for this and alike cases?

Many thanks again!! Cheers Christiaan

Hi @Christiaan_Huizer ,
Very honestly I didn’t quite get your full use case: extracting some rows, concatenate them in a single string to then split them again…? :thinking:

Would it be OK for you to share a bit of your data lifecycle transformation?