Extracting Middle Characters

Problem: The NewYork file presents cost center, account, and account description as a continuous string, rather than as three strings. You want to separate the account strings from the cost center and account description strings.


The image shows the contents of the NewYork General Ledger screen. The contents are described in the text preceding the image

Solution: In the Import Formats screen, assign the following script to the Expression field of the Account row. In the Import Formats screen, assign the following script to the Expression field of the Account row. The script extracts and returns the characters of the account strings (the characters from positions 7 to 10 of the string):

def Parse_Account (strfield, strrecord):
   return strField[6:10]

Result: Account strings are separated from cost center and account description strings.

Result: In the Account column of the import file, only account numbers are displayed.