The post will look into it's possibilities and how it works.
What actually is the Test Data Transfer Tool?
The Test Data Transfer Tool (TDTT) uses SQL Server's Bulk Processing Program (BCP) to move the data from one AX database to another. That means that the business logic validation in AX itself isn't used. On the other hand, it's fast and we like fast.
In order to be able to use the TDTT, you need to have SQL Server Client Tools installed and run the tool from the server which hosts the database.
Expressions in the Export
There are four expressions you can use to export:
. Match any single character
* Match the previous expression zero or more times.
(?<! subexpression) Prevent a match if the end of the previously matched content matches the subexpression. This expression is known as a zero-width negative lookbehind assertion.
^ Match the start of the string.
How to export / import
In the command prompt, go to C:\Program Files (x86)\Microsoft Dynamics AX 2012 Test Data Transfer Tool (Beta)\
To Export:
dp export "c:\temp" <databasename> <servername>
To Import:
dp import "c:\temp\importfilename" <databasename> <servername>
Some possiblities
Export a single or two tables
After installing the tool, you'll have an interesting directory named: [Lists]. Here you can manipulate the tables which are to be excluded from the export (default installation path is: C:\Program Files (x86)\Microsoft Dynamics AX 2012 Test Data Transfer Tool (Beta)\[Lists]).
So, if we would like to exclude all tables, but the table TaxAuthorityAddress, create a new file in the [Lists] folder and the expression should be:
// Don't export any tables except TaxAuthorityAddress
.*(?<!^TaxAuthorityAddress)
If you only want to export TaxAuthorityAddress and CustTable, the expression would be:
// Don't export any tables except TaxAuthorityAddress and CustTable
.*(?<!^TaxAuthorityAddress)(?<!^CustTable)
Export a table and filter rows from it
Now we want to export the TaxAuthorityAddress, but only for company NL. In order to do this, you need to create a new file named: filters.xml.
In it, enter the following and save the file in the [Lists] folder. Define the table name and in it, set the field on which you need the filter and the filter value.
<tables>
<table name="TaxAuthorityAddress">
<filter>
<field>DataAreaID</field> = 'NL'
</filter>
</table>
</tables>
Import data and run a SQL Script after it
The import tool truncates the table before importing the file. So be aware, you cannot import data only for one company when you have multiple companies in your environment.
You can create your own SQL scripts and place them in the [import] folder in the TDTT root folder. When the import of the data has been done, the script(s) will be executed. It could be very handy to include a script which updates your parameters to your test environment settings.
As an example, I created a simple script to update my TaxAuthorityId to '007':
USE [DAX2012R3];
UPDATE TaxAuthorityAddress
SET TaxAuthorityId ='007'
WHERE DataAreaId ='NL';
After importing the TaxAuthorityAddress which I exported earlier, you can now see that the field is updated:
My verdict: nice tool; clean, fast and simple, I like it.
No comments:
Post a Comment