X++ File Introduction

Rumman Ansari   Software Engineer   2019-09-30   6699 Share
☰ Table of Contents

Table of Content:


How to read a csv or text file using AX



static void CsvFileJob1(Args _args)
{
    System.IO.StreamReader reader;
    System.String stringLine;
    InteropPermission interopPermission;
    str line; 
    interopPermission = new InteropPermission(InteropKind::ClrInterop);
    interopPermission.assert();
 
    reader = new System.IO.StreamReader(@'C:\Users\ansarir2\Desktop\Studentinfo.csv');
    stringLine = reader.ReadLine();
    while (!System.String::IsNullOrEmpty(stringLine))
    {
        line = stringLine;
        info(line);
 
        stringLine = reader.ReadLine();
    }
    reader.Close();
    reader.Dispose();
    CodeAccessPermission::revertAssert();
}