The following X++ job code sample creates a file and writes to it. Next the code reads from the file, and prints every record to the Infolog. The use of the FileIOPermission class is also illustrated. FileIoPermission is used to assert that the current method has the authority to call another method that checks for…
Tag: FileImport
Microsoft Dynamics Ax
kranthi AX: Importing data from text file in Axapta
by Bo Jensen •
The code will help you to import data from text file and create a sales order.
Microsoft Dynamics Ax
X++ CODE TO READ MS OFFICE WORD DOCUMENT
by Bo Jensen •
Use the below job if you want to read text from MS Word document in Dynamics Ax 2009.
Microsoft Dynamics Ax
Dynamics AX Solutions: Filtering Excel and CSV files in a dialog
by Bo Jensen •
Here is a small peace of Axapta x++ code, that allow you to filter XLSX and CSV files in a dialog box… This is useful if you want to show only this type of files in a selection. public Object dialog() { DialogRunbase dialog = super(); #AviFiles #Excel dialogFilename =…
Microsoft Dynamics Ax
Counting lines from textfile in Axapta Programming
by Bo Jensen •
TextBuffer tb = new TextBuffer(); FileName myfile; // path to the csvfile tb.fromFile(‘myfile’); info(int2str(tb.numLines)); Counting lines from textfile in Axapta Programming
Microsoft Dynamics Ax
Dynamics AX: Read All Files inside a directory
by Bo Jensen •
void FindAllCSV() { #Evat_NL #File Filename baseFolder; Filename csvFilename; Filename foundBaseFileName; Filename foundFileName; container mainFolder, subFolder, fileContainer; boolean filesFoundMainFolder = true; boolean filesFoundSubFolder = true; int apiResult; int setCurrentFolder (Filename _filename = ”) { ; return WinAPI::setCurrentDirectory(_filename); } ; baseFolder = “C:TEST”; apiResult = setCurrentFolder(SysTreeNode::duplicatePathDelimiters(baseFolder)); mainFolder = WinAPI::findFirstFile(“*.*”); foundBaseFileName = conpeek(mainFolder, 2); while (filesFoundMainFolder) {…
Microsoft Dynamics Ax
How to import multiple file from a folder? – Microsoft Dynamics AX
by Bo Jensen •
container createListOfFiles(FilePath _path = path, FileNameType _pattern = pattern) { System.Array files; int fileCount; int i; str nextFile; new InteropPermission(InteropKind::ClrInterop).assert(); info(strfmt(‘Search in: %1 %2’, _path, _pattern)); listOfFiles = connull(); actIx = 0; files = System.IO.Directory::GetFiles(_path, _pattern); if (files) { fileCount = files.get_Length(); info(strFmt(‘Number of…