Skip to main content

How to Fix [LineStart()] Issue after C/AL Object Text Export?

Hi Readers,

I have heard about this issue from a long time but never faced this issue personally. 

Yesterday While reviewing an Upgrade Merge during comparison, I faced this issue during comparison. 

In this article, We will understand why & when this is a problem and I will share my View to fix this issue.

#MSDYNNAV

Which version of Dynamics NAV / Business Central (C/AL) it applies to?

  • This problem started with Dynamics NAV 2018 (If I am not wrong). 
  • You can see [LineStart()] in the exported Text file.
  • These Lines don't cause issue during importing / exporting objects to and from Dynamics NAV.


If there are no issues why should we worry about it?

This becomes an issue during two operations - 

  • During Comparing objects via a Text Comparison tool, it becomes hard to compare objects.
  • During C/AL To AL Conversion process these Lines get converted to AL files which need to removed Manually.

How To Solve this Issue?

PowerShell comes to Rescue.

In this scenario, My way to do it is with PowerShell. 

Steps to Fix this issue.

  • Open PowerShell, and Change Directory to that folder (as shown below).
    • Cd "D:\Virtual Machine\Shared\Today"

  • PowerShell comes with a cmdlet which can read file. The command is Get-Content.
    • Get-Content '.\Export.txt'


  • The Cool PowerShell comes with a Pipe command where you can redirect output to another command. 
  • In this scenario, We will use regex to find that pattern using Where-Object and -notmatch to not find. 
  • The output of this command will be removed [LineStart()] Lines.
    • Get-Content '.\Export.txt' | Where-Object {$_ -notmatch '\[LineStart\('}


  • Again using Pipe Symbol we can redirect it a file as shown below. This will create new file.
    • Get-Content '.\Export.txt' | Where-Object {$_ -notmatch '\[LineStart\('} | Out-File '.\Export_out.txt'


  • If you compare input and output files you will see that those lines are removed.


As its a PowerShell cmdlet you can run it either C/AL Text files or Converted AL Files where this issue exist.

Hope you find the article useful. Let me know your views as comment to this article.

Regards,
Saurav Dhyani

www.sauravdhyani.com

Comments

  1. This is due to opening a DB with the generatesymbolreference=yes. Just remove it export again.

    ReplyDelete
    Replies
    1. Yes, but we need to keep that on, for customer who are in mixed mode.

      Delete
  2. Thanks Mark,
    That make sense. Can you please provide a scenario where I would like to Import this file again?
    I faced the issue while comparing files so I don't think I will require to re-import the file in database. With Linestart removed I used it for comparing (manual / PowerShell) for merging changes in New Version.

    I will be interested to understand in which scenario you would like to import this file back in database.

    ReplyDelete

Post a Comment

Popular posts from this blog

VIEW SERVER STATE permission on SQL Server?

Hi all, Sometime While trying to Login into a database we face an error message as shown below. --------------------------- Microsoft Dynamics NAV Classic --------------------------- You cannot start Microsoft Dynamics NAV Classic because you do not have the VIEW SERVER STATE permission on SQL Server. Contact your system administrator. --------------------------- OK    ---------------------------

RTC Report It is not possible to instantiate the Visual Studio bridge.

Hi all, As a Navision developers I have Multiple Versions of Navision running in single Machine. As discussed Earlier in the post how to run multiple Version of RTC in single machine. So my machine have following details for RTC Versions - NAV 2009 R2    - is installed. NAV 2009 SP1  - is copied at C:\Program Files (x86)\Microsoft Dynamics NAV\60\NAV 6.0 SP1 IN\ NAV 2009         - is copied at C:\Program Files (x86)\Microsoft Dynamics NAV\60\NAV 6.0 IN\ This approach has been working great for execution of Classic and RTC Clients. However, after installing Dynamics NAV 2009 R2, if i tried to view the Layout for an NAV 2009 SP1 Report i was getting the following error: ---------------------------  Microsoft Dynamics NAV Classic  ---------------------------  It is not possible to instantiate  the Visual Studio bridge.  ---------------------------  OK    --------------------------- After searchi...

NAV 2013 R2 - Cumulative update 12 Released.

Hi all, Please find below the details of  Cumulative Update 12 released for Microsoft Dynamics NAV 2013 R2. Title - Cumulative Update 12 for Microsoft Dynamics NAV 2013 R2 Build No. - 38053 Release Date - October, 2014 Local Version Included - AU, AT, BE, CH, DE, DK, ES, FI, FR, IS, IT, NA, NL, NO, NZ, SE, UK, RU Download Link Note: Implementing this cumulative update will require a database conversion unless you have already implemented update rollup 5.