Tuesday, November 21, 2017

JOB X++ MICROSOFT AX PULL /SAVE DATA IN CSV FILES :WINAPI FILES : DYNAMICS AX X++ CODE

JOB X++ MICROSOFT AX DATA IN CSV FILES WINAPI

static void VIK_VM_SalesLineToCSVTable(Args _args)
{
    PurchLine       purchLine;
    SalesLine       salesline;
    Query q;
    QueryBuildDataSource qbds;
    QueryBuildRange qbr;
    QueryRun qr;
    CommaIO commaIO;
    FileName fileName;
    InventTable inventTable;
    salestable  salestable;
    ;
    fileName = "C:\\Vicky\\" + "SAlesline_serial_newD" + ".txt"; //Destination of the file
    commaIO = new CommaIO(fileName,'W');

    commaIO.write("Sales Id", "Custaccount","Itemid","SalesStatus", "Serial Number"); //Header of the CSV File

    //Loop to insert values in the csv from the table
    while select salesline
            join salestable where SalesLine.salesid == SalesTable.salesid && salestable.salesstatus == SalesStatus::Backorder
                         //  && salesline.SalesId like "%SOD%"//(salestable.salesstatus == SalesStatus::Delivered || salestable.salesstatus == SalesStatus::Backorder)//&& salestable.SalesId like "%SOD%"
    {
    commaIO.write(salesline.SalesId, salestable.CustAccount, SalesLine.ItemId,SalesTable.SalesStatus,SalesLine.inventDim().inventSerialId);


    }
    WINAPI::shellExecute(fileName);
    info("DONE.");
}


No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...