最新消息:ww12345678 的部落格重装上线,希望大家继续支持。

在X ++中读取CSV文件 / Read CSV file in X++

网络文摘 William 868浏览 0评论

Purpose:

The purpose of this blog post is to demonstrate how to read a csv file in X++

Product:

Dynamics AX 2012

Code:

static void MAKReadFile(Args _args)
{
    #File

    IO           io;
    CustAccount  custAccount;
    Email        email;
    FilenameOpen filename = @"C:\Temp\CustomerContactInfo.csv";
    Container    record;
    ;

    io = new CommaTextIo(filename, #IO_Read);

    if (!io || io.status() != IO_Status::Ok)
    {
        throw error("@SYS19358");
    }

    while (io.status() == IO_Status::Ok)
    {
        record = io.read();

        if (record)
        {
            custAccount = conpeek(record, 1);
            email = conpeek(record, 2);
            info(strFmt("%1 %2", custAccount, email));
        }
    }
}
发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址