Connectivity Studio and ICM text imports

Jun 9, 2016 7:00:34 AM

Connectivity Studio and ICM text imports

Learn how to import ICM text files with only a field separator

As today’s tutorial shows, you can easily customize To-Increase Connectivity Studio for Microsoft Dynamics AX without changing our standard code. We are going to work through importing text files in ICM format with only a field separator.

Sometimes requests for ICM files are not easy to follow in setup, because the format has some limitations: It has only a field separator and no record separator. Normally, there is a line with multiple fields:

ICM Connectivity Studio 1

The ICM format is different. It contains one field per line. The field separator is a carriage return and linefeed.

ICM Connectivity Studio 2

There are some restrictions to the ICM format:

  • It contains one header with multiple lines.
  • Each line and header always have the same number of fields.

We overcome these as follows.

Solution: Code additions and extending the text file base class with an XPO file

First define the test file and save it in a folder which can be accessed by a Connectivity Studio AOS user.

ICM Connectivity Studio 3

This format is not supported out-of-the-box. Therefore, we need some code additions that do not change the class in Connectivity Studio, but create a new one to be used. This also avoids future upgrade problems. The idea is to set up a document with only two records, one for the header and one for the lines. The steps are as follows:

  • Create a new document of the type Text and specify the field separator as shown below.

ICM Connectivity Studio 4

  • Add a record and call it
    • Add field1, field2, field3 to it.
  • Add a record and call it Specify the header as parent.
    • Add field1, field2, field3 to it.

The form will look like the screen image below.

ICM-Connectivity-Studio-5

The problem is that you need to read the files differently. Now Connectivity Studio should read the first 3 fields and use that as header. Field 4, 5, and 6 are the first line, the next 3 fields are the second line and so on. That means that the way Connectivity Studio reads the fields should be changed. To accomplish this, you need to extend the base class for text files.

An XPO file is attached. It contains the class, which is described and which can be imported into the target environment. This is what the XPO file prompts Connectivity Studio to do:

  • When the headers are defined, it will always—based on the document definition—check the document and the number of fields to see how many lines should be read, given that each field is a line.
  • When the record is read, it will read the first set as header, all others as lines.

You can download the XPO file from Class_TstDocumentTextICM.xpo. After the download, you can import the XPO file into your development environment and select it as a custom handler in your document.

ICM Connectivity Studio 6

Now you're ready to run a test for the file. In the development pane, you can select the test option where you can specify a folder connection and a link to your file name. After running the test, you should see a result like illustrated below.

ICM-Connectivity-Studio-7

Thanks for following along! I hope this tutorial helped you work with ICM text files in Connectivity Studio. If you need more information about our Business Integration Solutions, please get in touch. If you have any suggestions for improving our tutorials, please let us know, and we will be happy to incorporate them when we can.

Share this message
About Author
Pieter de Jong

Pieter de Jong

Business and Application Integration Specialist Pieter translates the business requirements of the industries and companies To-Increase serves into functionality in our Business Integration Solutions for Microsoft Dynamics AX. His specialized skills include model-driven development, Javascript, Java, HTML, XML, Visual Studio, and Eclipse. Before Pieter joined the team at To-Increase, he spent a career of close to 20 years as a software engineer and developer at Baan Info Systems and in other companies.

Get In Touch

Related Blogs

Aug 8, 2019 11:07:10 AM
Jul 9, 2019 9:31:11 AM
Jul 1, 2019 8:09:49 AM