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

Question

Question

Find/Replace Regular Expression?

asked on May 27, 2015

Not sure about this, but is it possible to have a find/replace regular expression? I basically want to convert letters into numbers from a string in a template field.

 

Example: 

"701.A" converted to "701.01"

"701.B" converted to "701.02"

"701.Z" converted to "701.26"

 

I would ultimately like to run a workflow which would convert these letters to numbers in a specific template field.

 

Thanks in advance.

Ali

0 0

Replies

replied on May 27, 2015 Show version history

Hi Ali,

 

Try a script, in a token stores the value of the field ( example value: 701.Z ) in the script the change is made and returns you another token "NewValue" the new value 701.26, then update this field with the new value.

 

        Protected Overrides Sub Execute()
            'Token with value
            Dim strValue as String = GetTokenValue("GetValueField_Document")

            Dim arrValues() as String = strValue.ToString.Split(".")
            Dim intValue as Integer = Microsoft.VisualBasic.Strings.Asc(arrValues(1).ToUpper)- 64

            strValue=arrValues(0) & "." & intValue.ToString.PadLeft(2,"0")
            
            'Token with new value
            SetToken("NewValue", strValue)
        End Sub


 

Attach the workflow, please rename the extension TXT with WFI ( Demo-ReplaceValueScript.wfi  )

I hope you help.

0 0
replied on May 27, 2015

Thanks Marco!!

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

Sign in to reply to this post.