Langsung ke konten utama

Postingan

Get List File from Folder on Microsoft Dynamics AX 2012 using X++

This code show how to get List of File from Folder and Subfolder static void GetFilesInFoldersAndSubFolders(Args _args) {     System.String[] filePaths = System.IO.Directory::GetFiles(@" folder location ", "*.*", System.IO.SearchOption::AllDirectories); //get listing of all files within the folder     int fileCount = filepaths.get_Length(); //get how many files were found     int currentFileCount;          //go throw each one of the files that were found     for(currentFileCount = 0; currentFileCount < fileCount ; ++currentFileCount)     {         info(filepaths.GetValue(currentFileCount));      } }

Write Ax Data to Txt in various Format

Public   void  sendTo_file(Editor  e) {     Filename filename;     TextIo io;      int  i =  strFind (e.path(),  '\\' ,  strLen (e.path()), - strLen (e.path()));      str  defaultName =  subStr (e.path(), i+ 1 ,  strLen (e.path()));     ;     filename = WinAPI::getSaveFileName( 0 , [ 'Text' , '*.txt' ],  '' ,  "@SYS56237" ,  'txt' , defaultName );      if  (filename )     {          // BP deviation documented          io =  new  TextIo(filename,  'W' ,  65001 );  // Write the file in UTF8         io.write(EditorScripts::getSelectedText(e));     } } > File for our future reference. /* UTF ...

X++ code to import data from text file(.txt) to Ax Tables

This the code to insert data from txt to AX static void Notepad(Args _args) { FilenameOpen filename; dialogField dialogFilename; Dialog dialog; TextIO file; NotepadTable notepadTable; container con; str conitem,conitem1,conitem2; int i; #File   ; dialog = new Dialog("Notepad Upoad"); dialogFilename = dialog.addFieldValue(extendedTypeStr(FilenameOpen),filename,"File Name"); dialog.filenameLookupFilter([".txt", #AllFiles]); dialog.filenameLookupTitle("Upload from Text File"); dialog.caption("Upload from text file"); dialogFilename.value(filename); if(!dialog.run()) return; filename = dialogFilename.value(); file = new TextIO(filename, #IO_READ); file.inRecordDelimiter('\n'); //For Next Record file.inFieldDelimiter('\t'); ttsbegin; while(file.status() == IO_STATUS::OK) { con = file.read(); conitem = conpeek(con,1); if(conItem!="0") { notepadTable.initValue(); notepadTable.Name=...

Force complete CIL recreation in MS Dynamics AX 2012

Prerequisite: Make sure that a full X++ compile was run without errors before 1) Stop all relevant AOS server(s)  2) On your relevant AOS server(s) navigate to the following folder (default) using Windows Explorer:  C:\Program Files\Microsoft Dynamics AX\60\Server\MicrosoftDynamicsAX\bin\XppIL  3) Make sure you create a safe copy of the XPPIL folder content to another new local folder on the AOS computer (example: C:\XPPIL_SAVE)  4) Now delete all folders and files inside the folder “C:\Program Files\Microsoft Dynamics AX\60\Server\MicrosoftDynamicsAX\bin\XppIL” but keep the folder “XPPIL” itself.  5) Start all AOS server(s)  6) Run a full CIL creation from AOT. This will create a fresh rebuild of all files/ folders inside the XPPIL folder

Create PDF from SSRS Form

Hi, i want to share code to create and save from SSRS Report I created a new Button, so after user selects data and clicks the button, system creates a PDF file and saves it to the destination folder. public static void main(Args _args) {     PurchTable                      purchTable,purchTable2, row;     PurchPurchaseOrderContract      purchPurchaseOrderContract;     VendPurchOrderJour              vendPurchOrderJour;     FormDataSource                  purchTable_ds;     SRSPrintDestinationSettings     settings;     SrsReportRunController          controller ;     str                             folderPath;     dialog     ...

Add an Image/Icon to an Action Pane Button [AX 2012]

Let start with the result. Below is a screenshot of Super Mario replacing the Customer icon. This is becoming a common question with AX 2012 using Action panes and all the buttons having images associated to them. It definitely adds to the usability. Follow the below steps and you’ll be alright. Get your icon file You can purchase your icon file on line or create them. To create them, create a png file with transparent background. Use either Photoshop or equivalent Gimp (free). Just Google on how to make an image transparent (I am very inexperienced and I got by – most people should be fine). Then go to  http://www.convertico.com/  and load up your png to convert to an ico file. From here on it is all standard AX. To add an image resource to the AOT In the AOT, right-click  Resources , and then click  Create from File . The  Select file  window opens. Navigate to the location of the image file that you want to use for a button. Click t...

Save SSRS report to pdf that uses Controller classes [Dynamics AX 2012]

Friends, This is the most commonly asked requirement of saving the report to pdf and send it to through email. We all know that SRSReportRun class is helpful in combination with printDestinationsettings to save to pdf file. But tricky requirements are those which uses controller classes for the report. Below is the small snippet which will help to save the sales invoice report to pdf that actually uses controller classes. static   void  SR_SaveReportToPDFFromController(Args _args) {     SalesInvoiceController  salesInvoiceController;     SalesInvoiceContract    salesInvoiceContract;     Args                    args =  new  Args();     SrsReportRunImpl        srsReportRun;     Cus...