Skip to main content

Hello,

 

How can I get the length of a string in NWC Workflow. I see there is a Length function in NWC Forms, but I am looking for this in NWC Workflows. 

 

Thank you.

May or may not work depending on the string your starting with.



 





 


Thank you @bsikes !!



 



That is rather counter intuitive, but it worked! 


Hi,



 



My approach would be to use a Regular expression to split the string up into a collection.
The config would look like this:



Then use a Count Items in collection action to count how many letters there are in the collection.



For some reason the count is always one more than required so just use a calculate a value action to subtract one.
 



Workflow would look like:



Export Key valid until this time on the 24th of October:
ma8vjTraMZYyHn6CzTfFM3tZmXRbDYTKWG5sGGUwxgjkkxap2


Thank you for this alternative solution, @SimonMuntz .



 



I tested your example and it works great for a single word. The string we want to check the length of could be any number of words, spaces and punctuation. What regex would you recommend for that situation? 


Hi,

I think this regex would cover it.
[Ss]

Thank you @SimonMuntz 



 



The regex [Ss] did indeed work with multiple words. And it even worked when I included a trailing space. 



 



I think this solution is cleaner than one I previously marked as the answer.


My only concern with @SimonMuntz suggestion, and this may be unfounded, was if there was a max limit on a collections size. I have no idea if there is one - but if there is, that may be a limitation you run into with that solution. 


Hi,



 



Collection do have a limit of 5000 objects.



So as long as the string is under 5k characters (which is a lot) my solution will work.


Reply