You are viewing limited content. For full access, please sign in.

Question

Question

Please consider adding substitution to workflow. (Workaround included)

asked on April 29, 2014 Show version history

With the addition of token passing to workflow in Quickfields I've been using workflow to do the heavy lifting for cleaning up and splitting apart address blocks and the like. 

 

However one key thing I'm missing is the ability to easily do substitutions without resorting to writing a custom script. I know that I could do a split and then join back together but that is rather wonky.

 

 

Here's an example:

 

I have a city line from an address block. The Address block floats somewhere on the document so I can't zone OCR the document. I also have to account for name, dba's, aka's, fka's, etc. So I pass a very large OCR zone to workflow as a token and have workflow do the heavy lifting of splitting things apart and making the educated guesses I want to make. Plus I break off some parts of the workflow into other workflows and call them by doing an invoke workflow (which allows me to reuse that in multiple document types easily and quickly)

 

However I get stymied by something that is easily fixed in Quick Fields if the state has been scanned in as W1 or WI (W + Vertical Bar) instead of WI.

 

I can easily fix the vertical bar issue since that shouldn't appear anywhere using a substitution in QF . However at the time I'm passing my data to workflow I can't turn all 1's into I's since I haven't narrowed it down to just the state abbreviation yet. 

 

And making tons of pattern matches making W1 into WI, 1N into IN, 1A into IA is a lot of extra work. 

 

1 0

Answers

APPROVED ANSWER
replied on April 4, 2016

As of Workflow 10, the expanded function set in Token Calculator includes Substitute.

3 0
SELECTED ANSWER
replied on May 1, 2014

It is on our to-do list, but I don't have a release date for it yet.

0 0
replied on April 4, 2016

Is this still on the "to-do" list? 

0 0
APPROVED ANSWER
replied on April 4, 2016

As of Workflow 10, the expanded function set in Token Calculator includes Substitute.

3 0
replied on April 4, 2016

Oh man, I totally missed that. Thank you! 

0 0
replied on August 18, 2017

Miruna,

The substitution only works with numbers and not letters?  Thank you.

0 0
replied on August 18, 2017

It works with either one: Substitute(input value, new value, old value).

0 0
replied on August 18, 2017

Thanks for the quick reply!

I just tried it with letters and it returned that it was not a valid expression.

Here's the same thing but with numbers.

0 0
replied on August 18, 2017

I'm on version 10.0.0.249.  Sorry I didn't include that before.

0 0
replied on September 25, 2017 Show version history

Shelby,

Sorry for the late reply, but I just ran into this issue myself.  It turns out that text strings need to be in quotes when clicking on Test Formula.  That fixed it for me.

1 0

Replies

replied on April 30, 2014

As a workaround, here's the script that will accomplish most of what a substitution control will do:

 

Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Data.SqlClient
Imports System.Text
imports Microsoft.VisualBasic   'make sure you add this!!!


Namespace WorkflowActivity.Scripting.Script
    '''<summary>
    '''Provides one or more methods that can be run when the workflow scripting activity is performed.
    '''</summary>
    Public Class SubScript
        Inherits ScriptClass90
        '''<summary>
        '''This method is run when the activity is performed.
        '''</summary>
        Protected Overrides Sub Execute()


                Dim OrignalString as String = GetTokenValue("TokenYouWantToCorrect")
                dim subme as String = replace(OrignalString, "1", "I")
                subme = replace(subme, "|", "I")  'the first "" is 
                subme = replace(subme, "l", "I")  'what you want to 
                subme = replace(subme, "0", "O")  'fix, the 2nd is 
                subme = Replace(subme, "!", "I")  'the replacement
                
                SetTokenValue("OutputToken", subme)

        End Sub
    End Class
End Namespace

 

2 0
replied on May 1, 2014

Thanks! 

 

It's fairly easy for me to do the scripting but when I turn it over to my clients I want them to be able to make the changes themselves. Anything involving scripting tends to be.... "scary"   for a non IS type person. 

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.