Skip to main content
Nintex Community Menu Bar
Solved

Studio workflow if contains numbers

  • June 20, 2017
  • 12 replies
  • 49 views
  • Translate

Forum|alt.badge.img+8

Hi there.  

 

This should be possible.

 

In K2 studio workflow, can someone help me build a data event that would have a function that would check a string.  If the string contains 8 numerals in a row anywhere in the string, it would extract those 8 numbers to a datafield that i could then use in another part of the workflow such as in a Smart Object method.  

 

If it doesn't contain 8 numerals in a row, it would just continue as normal.

 

Thoughts?

 

rob

 

Best answer by JRoberts1

Hi Robert,

 

See attached zip for more detailed instructions as well as a Workflow Example file called StringTest.kprx. You can use the Data Event, Data Transfer option along with Regular Expressions functions to accomplish this.

 

The basic regular expression pattern you can use is the following:

 

d{8}

However, experiment with that based on your requirements.

 

Hope this helps!

 

Jason

  

NOTE: This was run with Blackpearl 4.7.  Also, there are other things you could check for if necessary, such is if your input string is >= 8 characters before running the data transfer event.

 

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

12 replies

Forum|alt.badge.img+5
  • 38 replies
  • June 23, 2017

Hi Robert,

 

Yes, you can do this fairly easily using the Data Transfer event along with Regular Expressions functions from the Text group of functions in the Workflow Context browser.

 

NOTE: Download the attached StringTest.kprx workflow solution file for K2 Studio for better reference.

 

 

1. Essentially, I created two DataFields for the workflow, one called "StringToTest" and the other "EightDigits". Although your input string to test can come from a Form input, SmartObject, etc.

 

StringToTest is used to house a string value of:   FB82909182AlbmCRP923

EightDigits is used to store the first matched string of eight consecutive digits.

 

2. Then I used them in the Data Event called "Transfer 8 Matched Digits to EightDigits DataField". This event uses the "Match Single" Regular Expression function in conjunction with this regular expression "d{8}", to scan the "StringToTest" datafield for 8 consecutive digits. If found, the fuction returns the first matched string.  e.g. 82909182 from FB82909182AlbmCRP923

 

NOTE: You may need to experiment with the Regular Expression for your own needs. RegexPal Tester helped me.

 

 

 

3. From there the DataEvent takes the return value and puts it in the DataField called "EightDigits". If it doesn't find a match, I just use the Empty String function from the Text group of functions as the return value. Notice the option in the above image called "Expected When Empty". From there, you can then use Line Rules to branch the workflow by testing if the EightDigits datafield is "Empty".

 

 

 

4. In the end, the results transferred accordingly.

 

Hope this helps!

 

 

Jason

 

 

NOTE: This was run with Blackpearl 4.7.  Also, there are other things you could check for if necessary, such is if your input string is >= 8 characters before running the data transfer event.

Translate

Forum|alt.badge.img+5
  • 38 replies
  • June 23, 2017

Hi Robert,

 

Yes, you can do this fairly easily using the Data Transfer event along with Regular Expressions functions from the Text group of functions in the Workflow Context browser.

 

1. Essentially, I created two DataFields for the workflow, one called "StringToTest" and the other "EightDigits". Although your input string to test can come from a Form input, SmartObject, etc.

 

StringToTest is used to house a string value of:   FB82909182AlbmCRP923

EightDigits is used to store the first matched string of eight consecutive digits.

 

 

3. From there the DataEvent takes the return value and puts it in the DataField called "EightDigits". If it doesn't find a match, I just use the Empty String function from the Text group of functions as the return value. Notice the option in the above image called "Expected When Empty". From there, you can then use Line Rules to branch the workflow by testing if the EightDigits datafield is "Empty".

 

 

Hope this helps!

 

 

Jason

 

 

NOTE: This was run with Blackpearl 4.7.  Also, there are other things you could check for if necessary, such is if your input string is >= 8 characters before running the data transfer event.

Translate

Forum|alt.badge.img+5
  • 38 replies
  • June 23, 2017

Hi Robert,

 

Yes, you can do this fairly easily using the Data Transfer event along with Regular Expressions functions from the Text group of functions in the Workflow Context browser.

 

1. Essentially, I created two DataFields for the workflow, one called "StringToTest" and the other "EightDigits". Although your input string to test can come from a Form input, SmartObject, etc.

 

StringToTest is used to house a string value of:   FB82909182AlbmCRP923

EightDigits is used to store the first matched string of eight consecutive digits.

 

 

3. From there the DataEvent takes the return value and puts it in the DataField called "EightDigits". If it doesn't find a match, I just use the Empty String function from the Text group of functions as the return value. Notice the option in the above image called "Expected When Empty". From there, you can then use Line Rules to branch the workflow by testing if the EightDigits datafield is "Empty".

 

 

Hope this helps!

 

 

Jason

 

 

NOTE: This was run with Blackpearl 4.7.  Also, there are other things you could check for if necessary, such is if your input string is >= 8 characters before running the data transfer event.

Translate

Forum|alt.badge.img+5
  • 38 replies
  • June 23, 2017

Hi Robert,

 

Yes, you can do this fairly easily using the Data Transfer event along with Regular Expressions functions from the Text group of functions in the Workflow Context browser.

 

Hope this helps!

 

 

Jason

 

 

NOTE: This was run with Blackpearl 4.7.  Also, there are other things you could check for if necessary, such is if your input string is >= 8 characters before running the data transfer event.

Translate

Forum|alt.badge.img+5
  • 38 replies
  • June 23, 2017

Hi Robert,

 

Yes, you can do this fairly easily using the Data Transfer event along with Regular Expressions functions from the Text group of functions in the Workflow Context browser.

 

 

1. Essentially, I created two DataFields for the workflow, one called "StringToTest" and the other "EightDigits". Although your input string to test can come from a Form input, SmartObject, etc.

 

StringToTest is used to house a string value of:   FB82909182AlbmCRP923

EightDigits is used to store the first matched string of eight consecutive digits.

 

 

3. From there the DataEvent takes the return value and puts it in the DataField called "EightDigits". If it doesn't find a match, I just use the Empty String function from the Text group of functions as the return value. Notice the option in the above image called "Expected When Empty". From there, you can then use Line Rules to branch the workflow by testing if the EightDigits datafield is "Empty".

 

 

Hope this helps!

 

 

Jason 

 

NOTE: This was run with Blackpearl 4.7.  Also, there are other things you could check for if necessary, such is if your input string is >= 8 characters before running the data transfer event.

Translate

Forum|alt.badge.img+5
  • 38 replies
  • June 23, 2017

Hi Robert,

 

Yes, you can do this fairly easily using the Data Transfer event along with Regular Expressions functions from the Text group of functions in the Workflow Context browser.

 

1. Essentially, I created two DataFields for the workflow, one called "StringToTest" and the other "EightDigits". Although your input string to test can come from a Form input, SmartObject, etc.

 

StringToTest is used to house a string value of:   FB82909182AlbmCRP923

EightDigits is used to store the first matched string of eight consecutive digits.

 

 

3. From there the DataEvent takes the return value and puts it in the DataField called "EightDigits". If it doesn't find a match, I just use the Empty String function from the Text group of functions as the return value. Notice the option in the above image called "Expected When Empty". From there, you can then use Line Rules to branch the workflow by testing if the EightDigits datafield is "Empty".

 

 

Hope this helps!

 

 

Jason

 

 

NOTE: This was run with Blackpearl 4.7.  Also, there are other things you could check for if necessary, such is if your input string is >= 8 characters before running the data transfer event.

Translate

Forum|alt.badge.img+5
  • 38 replies
  • June 23, 2017

Hi Robert,

 

Yes, you can do this fairly easily using the Data Transfer event along with Regular Expressions functions from the Text group of functions in the Workflow Context browser.

 

1. Essentially, I created two DataFields for the workflow, one called "StringToTest" and the other "EightDigits". Although your input string to test can come from a Form input, SmartObject, etc.

 

StringToTest is used to house a string value of:   FB82909182AlbmCRP923

EightDigits is used to store the first matched string of eight consecutive digits.

 

 

3. From there the DataEvent takes the return value and puts it in the DataField called "EightDigits". If it doesn't find a match, I just use the Empty String function from the Text group of functions as the return value. Notice the option in the above image called "Expected When Empty". From there, you can then use Line Rules to branch the workflow by testing if the EightDigits datafield is "Empty".

 

 

Hope this helps!

 

 

Jason

 

 

NOTE: This was run with Blackpearl 4.7.  Also, there are other things you could check for if necessary, such is if your input string is >= 8 characters before running the data transfer event.

Translate

Forum|alt.badge.img+5
  • 38 replies
  • June 23, 2017

Hi Robert,

 

Yes, you can do this fairly easily using the Data Transfer event along with Regular Expressions functions from the Text group of functions in the Workflow Context browser.

 

1. Essentially, I created two DataFields for the workflow, one called "StringToTest" and the other "EightDigits". Although your input string to test can come from a Form input, SmartObject, etc.

 

StringToTest is used to house a string value of:   FB82909182AlbmCRP923

EightDigits is used to store the first matched string of eight consecutive digits.

 

 

3. From there the DataEvent takes the return value and puts it in the DataField called "EightDigits". If it doesn't find a match, I just use the Empty String function from the Text group of functions as the return value. Notice the option in the above image called "Expected When Empty". From there, you can then use Line Rules to branch the workflow by testing if the EightDigits datafield is "Empty".

 

 

Hope this helps!

 

 

Jason

 

 

NOTE: This was run with Blackpearl 4.7.  Also, there are other things you could check for if necessary, such is if your input string is >= 8 characters before running the data transfer event.

Translate

Forum|alt.badge.img+5
  • 38 replies
  • June 23, 2017

Hi Robert,

 

Yes, you can do this fairly easily using the Data Transfer event along with Regular Expressions functions from the Text group of functions in the Workflow Context browser.

 

1. Essentially, I created two DataFields for the workflow, one called "StringToTest" and the other "EightDigits". Although your input string to test can come from a Form input, SmartObject, etc.

 

StringToTest is used to house a string value of:   FB82909182AlbmCRP923

EightDigits is used to store the first matched string of eight consecutive digits.

 

 

3. From there the DataEvent takes the return value and puts it in the DataField called "EightDigits". If it doesn't find a match, I just use the Empty String function from the Text group of functions as the return value. Notice the option in the above image called "Expected When Empty". From there, you can then use Line Rules to branch the workflow by testing if the EightDigits datafield is "Empty".

 

 

Hope this helps!

 

 

Jason

 

 

NOTE: This was run with Blackpearl 4.7.  Also, there are other things you could check for if necessary, such is if your input string is >= 8 characters before running the data transfer event.

Translate

Forum|alt.badge.img+5
  • 38 replies
  • June 23, 2017

Hi Robert,

 

Yes, you can do this fairly easily using the Data Transfer event along with Regular Expressions functions from the Text group of functions in the Workflow Context browser.

 

NOTE: Download the attached StringTest.zip workflow solution file for K2 Studio for better reference.

 

 

  1. Essentially, I created two DataFields for the workflow, one called "StringToTest" and the other "EightDigits". Although your input string to test can come from a Form input, SmartObject, etc.

 

StringToTest is used to house a string value of:   FB82909182AlbmCRP923

EightDigits is used to store the first matched string of eight consecutive digits.

 

  1. Then I used them in the Data Event called "Transfer 8 Matched Digits to EightDigits DataField". This event uses the"Match Single" Regular Expression functionin conjunction with a regular expression(see image below for pattern), to scan the "StringToTest" datafield for 8 consecutive digits. If found, the fuction returns the first matched string.  e.g. 82909182 from FB82909182AlbmCRP923

 

NOTE: You may need to experiment with the Regular Expression for your own needs. RegexPal Tester helped me.

 

 

 

  1. From there the DataEvent takes the return value and puts it in the DataField called "EightDigits". If it doesn't find a match, I just use the Empty String function from the Text group of functions as the return value. Notice the option in the above image called "Expected When Empty". From there, you can then use Line Rules to branch the workflow by testing if theEightDigitsdatafield is "Empty String".

 

 

 

  1. In the end, the results transferred accordingly.

 

 

Hope this helps!

 

Jason

  

NOTE: This was run with Blackpearl 4.7.  Also, there are other things you could check for if necessary, such is if your input string is >= 8 characters before running the data transfer event.

 

Translate

Forum|alt.badge.img+5
  • 38 replies
  • Answer
  • June 23, 2017

Hi Robert,

 

See attached zip for more detailed instructions as well as a Workflow Example file called StringTest.kprx. You can use the Data Event, Data Transfer option along with Regular Expressions functions to accomplish this.

 

The basic regular expression pattern you can use is the following:

 

d{8}

However, experiment with that based on your requirements.

 

Hope this helps!

 

Jason

  

NOTE: This was run with Blackpearl 4.7.  Also, there are other things you could check for if necessary, such is if your input string is >= 8 characters before running the data transfer event.

 

Translate

Forum|alt.badge.img+8

Wonderful!  I have not tried it yet, but from what I can see, I think it's going to work perfectly.  

 

I hope to someday have enough K2 Studio knowledge to return the favor. :)

 

Rob

 

 

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