Test Data Transfer Tool: Getting errors from log

I imported data to AX with the Test Data Transfer Tool and it told me that some errors occured. The log file is quite large, so I asked myself what’s the easiest way to find these errors. This is my approach, using a very simple Powershell script:

[xml]$dplog = Get-Content C:\Windows\System32\dplog.xml
$dplog.root.item | ? Status -eq "Failed"

Note that this is for Powershell 3; you would have to change it to something like this if you still use Powershell 2:

[xml]$dplog = Get-Content C:\Windows\System32\dplog.xml
$dplog.root.item | ? {$_.Status -eq "Failed"}

This is how the output looked like in my case:

status      : Failed
message     : One or more indexes were disabled on table TableXYZ to allow the data to import.
              Use the following SQL to enable the indexes once you've fixed the data:
                  ALTER INDEX ALL ON [TableXYZ] REBUILD
              The original index violation message is:
              Cannot insert duplicate key row in object 'dbo.TableXYZ' with unique index
              'I_104274XYZIDX'. The duplicate key value is (5637144576, 196, , ).
              The statement has been terminated.
direction   : Import
action      : Overwrite
database    : TestAX
table       : TableXYZ
targetTable : TableXYZ
folder      : C:\TestData

Leave a Reply

Your email address will not be published.