web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Dynamics 365 Community / Blogs / Simple AX / Template for import CSV fro...

Template for import CSV from job

Daniele Ferraretto Profile Picture Daniele Ferraretto

Hi there some way to import data from CSV file. The below template could be useful is you not only insert data in a table but for example do some other duty ( example send mail with read data from a table and in csv have the email and foreign key … and so on

static void impCSVFile(Args _args)
{
FormStringControl fileNameControl;
Str 100 codart,G;
CommaIo csvFile;
container readcon;
dialog d = new Dialog();
dialogField df, dfDate;
;

d.addText("name file to import");
df = d.addField(extendedTypeStr(filenameopen),"File NAme");
d.run();

if(!d.closedOk())
return;
csvFile = new CommaIo(df.value(), 'r');
csvFile.outFieldDelimiter(";");
csvfile.inFieldDelimiter(";");
csvFile.outRecordDelimiter("\r\n");

readCon = csvFile.read();

while (csvFile.status() == IO_Status::OK)
{
readCon = csvFile.read();

//TODO insert here your logic
}
}


This was originally posted here.

Comments

*This post is locked for comments