Monday, September 21, 2015

Upgrade From Classic To RTC - Issue with Line Feed and Horizontal Tab.

Hi All,

Today I would like to discuss a issue that we have during upgrade from Navision Classic Client to Navision RTC Client.

What is the issue ?

The Issue is with the data having Line Feed & Horizontal Tab.

On Which Fields the issue is?

The major issue is with the Primary key field. On Fields other than primary key it dosent make much of the difference.

What is the Reason Behind the Issue?

The Issue normally occurs when customer enter data in system by any of below listed ways -
1. Copying Data from Excel to Navision.
2. Data Inserted in Navision From Integration In Navision with Third Party.

Why Primary Key Field having Issue ?

If the Navision Primary Key Fields have Line Feed and Charter feed in data, it upgrades to SQL in same manner, but the front end (Role Tailored Client) trims these character which trying to Open record. The Role Tailored client display and error message saying "Cannot Open the Record".

How we can resolve it ?

Yes we can do it by creating a Report in Navision which Trims Line Feed and Horizontal Tab from the data. But the Report take so much time if the database size is huge because we need to identify for all text and code Field.

So with a bit of SQL Knowledge I created a Query which we can run before starting the upgrade process. The Query List down Table Name, Field Name and Data that have these special Symbol.

 As these are primary key fields we cannot clear those special symbol from SQL as related records will not be updated.

Like if the customer Number contain these special characters, if we rename the customer from SQL the customer ledger entries will not be updated. 

So without wasting time below is the query and its explanation -

Below are the Pointer Description -

1. Deleting Temp Table if still exist.

2. Creating Temp Table for storing the results of the query.

3. Applying the Filters -
            Data Type = nvarchar (Text and Code)
            Ordinal Position < 22 (explained Later) and
            Table Name like '%$%' (Only Navision Company Specific Tables)

4. Trying to Filter Data With Special Charter ASCII Value (9 & 10)
5. Displaying the result.

Now Let's talk about Ordinal Position < 22 -

1. Every NAV Table in SQL have 1 additional Field "TimeStamp"  ==> Ordinal Position 1

2. Every NAV Table Key can have Maximum 20 Fields. So the Maximum Number of fields in Primary Key = 20. All Fields in Primary Key are Ordinal Position starting from 2 in-respective of NAV Field Sequence.

So total Fields that I would like to check for special symbol = 20 + 1 = 21 Fields.

When we execute the Query, the results will be something like this -

Third Row and First Column shows that the lot not have a Value with Line Feed. We need to rename the Lot No. in Navision. Once the Lot No. is correct then all related records will also get updated.

I would still like someone SQL Help to identify only primary key fields instead of checking for 22 fields.

As it can be one primary key field and not nvarchar like Ledger tables with Integer Primary Key - "Entry No.".

Hope the Query Helps. Please put your comments about the articles.

You can download the query from -

SkyDrive  (File Name - Identify_Special_Character_SQL_Query_V2.0.rar)



** New Update (06-Apr-2016) - An Updated Version of query (faster query) can be accessed here.

Stay Connected.

Saurav Dhyani

No comments:

Post a Comment