SheriDyn 11/11/2018 7:36:22 PM

Looking for assistance with .net Substring Function with segments of a general ledger account

I am creating a calculated column to pull the GP PA Project ID from a segment of the GL string to build an PO PA Receipt import

I need to extract the Project ID if greater than 000 from the 6th segment of this account string XXX-15-XXXX-XXX-300-XXX where segment 2 equals 15 and segment 5 equals 300.

Note: Smartconnect requires that I write the calculated column code using .NET -  I believe I need to use Substring, but cannot locate any documentation that shows me the .Net Syntax for Substring.

here's is what I wrote:

Dim mySegtwo as String = _Account.ToString.Trim

Dim mySegFive as String = _Account.ToString.Trim

Dim mySegSix as String = _Account.ToString.Trim

If String.IsNullOrEmpty(mySegtwo) Then

     Return ""

Else If mySegtwo.Substring(5,2) = “15” and mySegFive.Substring(17,3) = “300” and mySegSix.Substring(21,3) > “000”  Then

  Return mySegSix.Substring(21,3)

End If

When I ran the code above - I got the message shown below? 

Just seeking assistance with this or if someone could possibly direct me to a site with some example .Net syntax - that would be ideal and greatly appreciated

Version: GP 2013
Section: .NET Development, Dynamics GP, SmartConnect


Table Definition Quick Links
All Tables
SOP Tables
RM Tables
GL Tables
POP Tables
HR Tables
PM Tables
UPR Tables
IV Tables
Olympic Tables
3