AX2012 X++ code to read the text file

//Create a new job and paste the code
static void RB_ReadTextFile(Args _args)
{
    Filename                                              filename = @'C:\Desktop\AX2012.txt';
    System.IO.StreamReader          reader;
    System.String                                   line;
    InteropPermission                       interopPermission;
    Str                                                         text;

    interopPermission = new InteropPermission(InteropKind::ClrInterop);
    interopPermission.assert();

    reader = new System.IO.StreamReader(filename,System.Text.Encoding::get_UTF8());
    line = reader.ReadLine();

    while (!System.String::IsNullOrEmpty(line))
    {
        line = reader.ReadLine();
        text = line;
        info(strfmt("%1", text));
    }

    reader.Close();
    reader.Dispose();
}

No comments:

Post a Comment

Install and Configure Zpl Printer on D365 F&O

  Setup Zpl Printer On D365 F&O Posted on Recently, I have had an opportunity review the possibilities to print license plates within D3...