Back

How to replace a parenthesis in a source file with a negative sign using a VB.NET script

Published: Dec 08, 2011
Post Author Written by David Youngquist

The source file is representing negative numbers by enclosing them within parenthesis. Need to change the numbers so they are represented as negative numbers in order for SmartConnect to import them.

The following script will read the quantity field and remove any parenthesis from around the value. replace the field named _quantity with the name of your column in the source file that contains the amount you want to convert to negative.

Dim myquantity As String = _quantity
‘Remove any left parentheses
myquantity = myquantity.Replace(“(“, “-“)
‘Remove any right parentheses
myquantity = myquantity.Replace(“)”, “”)
Return myquantity

Feeling stuck? Get the support and guidance you need to help you power through any data challenge

We're on your integration team. Connect with our people and let us know how we can help you.