Showing posts with label Data Import. Show all posts
Showing posts with label Data Import. Show all posts

Thursday, September 6, 2012

Zip Codes Upload in AX 2012

 

Hi there,

Today I would like to discuss how to load Zip Codes to AX 2012 from a Text file and also point out what happens in the background.



In AX 2012, this task is fairly simple as there is an abstract class (AdressZipCodeImport) that takes care of this function. In addition to the abstract class, there is another class (AdressZipCodeImport_US) for each specific country that overwrites the ReadFile() method in the AddressZipCodeImport abstract class. In AX 2012, there only 4 countries available for Zip Code upload.

AddressZipCodeImport Class:

 
 


AddressZipCodeImport_US Class:




The AdressZipCodeImport_US class ReadFile() method contains a while loop that will allocate the data from the file being read  into the LogisticsAddress variables. To accomplish this, you will have to have your zip code, city, state and county name in an Excel file where you create the required spaces between fields and then save it as space delimiter file.

ReadFile() Method:




The following is an example of this sequence:


 

The following is the ReadFile() sub string coordinates:

 

When your file is ready, you can upload it by going to Organization Administration > Setup > Addresses > Import Zip/Postal codes:


Once you run this, the data will be in the LogisticsAddressZipCode table

 

It is very interesting to see how the AX 2012 team has put a lot of thought into these common tasks as they help us be more efficient on something we don't need to really spend a lot of time figuring out.

Until the next time!



Wednesday, September 14, 2011

AX 2009 Data Import / Export

The following post is about shows how to:
1-   Export data from a company in AX using a definition Group
2-   Creating a new company that will take the new data
3-   Importing the data exported from step 1 into the new company created in step 2 using a definition group as well.
In a current project, I needed to freeze the Test1 environment due to some focus testing of a certain functionality we implemented. At the same time, we needed to allow the uses to keep testing other customizations without affecting Test1.
In addition, to make the user’s lives easier, we decided to have the same data that they were using in Test1 in our Test2 instance. So, we exported the data from our Test1 environment, and then imported it to a new company in our Test2 environment.
The following steps will show this process step by step:

1-   First select the company you want to export the data from as the AX current company by clicking in company name in the right lower corner of your AX interface.

2-   This would open the “Select Company” form as shown;
3-   Select  Administration (module)
4-   Under periodic->Data exports /import ->Click Export to
5-   The “Export options” form will appear
6-   Select a definition group. You can either create a new definition group to include what you need, or just choose ALL to get all the tables.

NOTE: In some cases, the already defined “ALL” definition group will not have all the tables, so in this case you would have to create a new definition group. In my case I created a new one name “ALL_NewDef” that included the latest tables.

7-   Enter a file name and select where to save it
8-   Click OK. At this point the company date export process should be done (after processing of course), and the files (.dat & .def) should have be saved on your computer.

Now, let’s create a new company

9-   Make sure that the selected company empty and click area node Administration
10- Click company Accounts under Common forms
11-   Press (Ctrl + N) in order to Create new company
12-   Make sure you select the newly created company as the current company

Import company file already exported in the prior steps and click Administration


13- Under periodic->Data exports /import ->Click import; The “Import options” screen will appear
14- Select the “import definition group” drop down list and choose ALL (otherwise create your own)
15-   Select the .dat file (exported before) and Click Ok to start the process

The import process may take some time according to the size of transactions in the original (exported) company.
In addition, you can choose to delete all the transaction data before the import when you are importing a .dat file o an existing company account to update the data.