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

Community site session details

Session Id :
Dynamics 365 Community / Blogs / Simple AX / Read text file … alternativ...

Read text file … alternative way to read all lines in one operation

Daniele Ferraretto Profile Picture Daniele Ferraretto

Hi, sometimes could be useful read files in one bulk operation directly from filesystem to an object and after managed this last one.

Below I’ve reported my experience, hoping could be interesting for all.

boolean loadFileInContainer()
{
ItemId item;

List buffer = new List(Types::Container);
System.Array lines;
int totLines;

try
{
lines = System.IO.File::ReadAllLines();
totlines = lines.get_Count();

for(i=0;i<totlines; i++)
{
[item] = Global::str2con(lines.GetValue(i),';');

buffer.addEnd([item]);
}
}
catch
{
return false;
}
return true;
}

 

bye!



This was originally posted here.

Comments

*This post is locked for comments