DAX 2012 AIF Outbound XML to CSV Transform

This question has suggested answer(s)

Greetings. I am running an AIF service (VendPaymentService) which exports an XML file with the payment information. I must convert this to a CSV format and research has shown me that I have to use a .NET Assembly to Transform do that. Microsoft has step-by-steps for creating an Inbound/Import .NET Assembly (CSV to XML), but not an Outbound/Export. I am a .NET amateur and MS's example shows how to call XML building tools and CSV reading tools, but I don't know how to build CSV building tools and XML Reading ones.

Here is the MSDN Article: msdn.microsoft.com/.../gg863930.aspx

To recap, I understand the overall concept that you build the .NET tranform and how to attach it to the AIF service but I am stuck on building the .NET Assembly itself and would like to know if anyone can provide me with help or an example of building the .NET transform from XML to CSV.

Thank you so much!

All Replies
  • You could probably use XSLT as well…
    About the assembly, it's trivial to write to write CSV; it's just a string. Parsing XML would be more difficult, but fortunately many great APIs exist, such as LINQ to XML.

    Martin "Goshoom" Dráb | Freelancer | Goshoom.NET Dev Blog

  • I did csv to xml , see my project dynamicsax2012csv.codeplex.com

    I think by changing the code a little bit you could do the same. it is a file stream in and file stream out.

    in your case the file stream in is the xml file

  • Hi

    As said it is quite easy to do the transform just the same way as inbound using the MS tutorial.

    Something like

    public void Transform(Stream xmlInput, Stream output, string configuration)


       sreader = new StreamReader(xmlInput);

       swriter = new StreamWriter(output);

       //Read your input xml and transform it to something useful

       // writing out:

       swriter.WriteLine("some output");



    The only thing I cannot figure out is how to get another filename than .xml

    So if anyone could tell me that it would be very much appreciated.


  • Seems AX always writes with the extension .xml

    In the class AifFileSystemSendAdapter the method getNewOutFileName() has the following line:

    filename = curTimestamp + #FileNameSeparatorCharacter + substr(counterText, strlen(counterText) - fileNumberMaxLength + 1, fileNumberMaxLength) + #XmlFileExtension;

    So I guess the solution is to create a parameter on the outbound port to set the fileextension to something else like csv and then change the system class to use this parameter.

    Do you have enough information to continue now?