Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.

Dynamically Update Count of Delimiter


I'd like to count the number of characters inputted from a text box/update a formula based on the number of characters. How do you do that?


What i am trying to do is based on what characters are in a field, count those characters. But the characters could change based on the input. So in one instance I could be counting - and \ and in another could be counting | and ,. Or in another counting all four. So the first step would be to say what characters to count and then based on that, count those characters.


Any help would be greatly appreciated!


To count the number of characters you can use the function REGEX_CountMatches.






To update a formula, google the CReW macro "Dynamic Formula". This will allow you to write a formula using this calculated field.


Yeah so I have the regex countmatches written. How would I update this dynamically? Say the delimeters were | and - then update the regex count matches formula to REGEX_CountMatches([Field1], "\||-"). Then if the delimeters are | and - and , then make it REGEX_CountMatches([Field1], "\||-|,"). Or if just - then, REGEX_CountMatches([Field1], "-")


I tried using the dynamic formula macro from CReW but not sure how to update the pattern part of the formula with it.



Hi @greg-e-13 


How are you defining which characters are counted? There are qualifiers in Regex that would count all non-alpha, non-numeric characters, for example Regex_Countmatches([Field],"\W").


Or, are you looking for user input into what to search for with each run? If that's the case, then perhaps a macro or an app can help with that. You'd be able to enter the characters you want to count, and then the app or macro could run with them. I'd probably feed the characters into a Text to Columns tool, parse into rows on the delimiter(s) and then use a Summarize tool to count the records. The count minus 1 should give you the number of instances.


Let me know if that helps.