Skip to main content
Nintex Community Menu Bar
Solved

Get length of a string in NWC Workflow

  • October 20, 2022
  • 8 replies
  • 329 views
  • Translate

Forum|alt.badge.img+4

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.

Best answer by SimonMuntz

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

View original
Did this topic help you find an answer to your question?

Forum|alt.badge.img+10
  • Scout
  • October 20, 2022

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

 

 

Translate

Forum|alt.badge.img+4
  • Scholar
  • October 20, 2022

Thank you @bsikes !!

 

That is rather counter intuitive, but it worked! 

Translate

SimonMuntz
Nintex Employee
Forum|alt.badge.img+22
  • Nintex Employee
  • October 20, 2022

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

Translate

Forum|alt.badge.img+4
  • Scholar
  • October 21, 2022

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? 

Translate

SimonMuntz
Nintex Employee
Forum|alt.badge.img+22
  • Nintex Employee
  • October 23, 2022
Hi,

I think this regex would cover it.
[Ss]
Translate

Forum|alt.badge.img+4
  • Scholar
  • October 31, 2022

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.

Translate

Forum|alt.badge.img+10
  • Scout
  • November 1, 2022

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. 

Translate

SimonMuntz
Nintex Employee
Forum|alt.badge.img+22
  • Nintex Employee
  • November 1, 2022

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.

Translate

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie Settings