SeparateWords Error

< Back
You are here:

When installing GP Agent, running the Synchronize Contact utility or updating a Customer or Vendor, you might get the following message: Unhandled script exception: Index 11 of local array is out of range in script ‘SeparateWords’. Script terminated.

This error happens because your data contains trailing spaces in the Contact Person column in your Customer Master or Vendor Master tables.

When GP Agent builds the Contact table, it parses the Contact Person field for the Customer or Vendor to separate the first and last names.  The parsing process looks for spaces in the contact person name and can parse a limit of 10 names. If more than 10 spaces are found in a full name, GP Agent will run out of space and generate the script exception.

When you enter data directly into Dynamics GP, you cannot add spaces at the end of a field.  You can enter “Joe Smith” as a contact, but if you press the space bar after you’ve typed in the name, Dynamics GP will not do anything and will not add those spaces to the data.  If you use Integration Manager to bring customer or vendors into Dynamics GP, the same restriction applies.  If, on the other hand, you add customers or vendors directly to the SQL tables outside of Dynamics GP, some applications (based on the ODBC ANSI paddings settings) will allow or even automatically add trailing spaces.  This can result in a customer with a contact person of “Joe Smith                      “.  Although this data will usually not have a negative impact on most of your Dynamics GP data, it can cause problems for some reports and for GP Agent.

1. Fix your existing data by running the following SQL statement against all of your company databases :
For Customers:
update rm00101 set cntcprsn = rtrim(ltrim(cntcprsn))
update rm00102 set cntcprsn = rtrim(ltrim(cntcprsn))
For Vendors:
update pm00200 set vndcntct = rtrim(ltrim(vndcntct))
update pm00300 set vndcntct = rtrim(ltrim(vndcntct))
2. fix the application that is inserting or updating your SQL tables to trim all char data columns. If this cannot be fixed, you will have to run step 1 whenever a customer or vendor is added to a company database.