Monday, 11 February 2008

X++ code for Export Table Data to Excel sheet.

static void ExportCurrencyExchangeRates(Args _args){
dteExchRates ldteExchRates;
SysExcelApplication excelApplication;
SysExcelWorkbooks excelWorkBooks;
SysExcelWorkbook excelWorkBook;
SysExcelWorksheets excelWorkSheets;
SysExcelWorksheet excelWorkSheet;
SysExcelRange range;
SysExcelCell SysExcelCell;
SysExcelCells SysExcelCells;
int lineNum=1; // int DataRowNum=1;
Amount exchRate;
Array arr;
Date EDate;
;

excelApplication = SysExcelApplication::construct();
excelWorkBooks = excelApplication.workBooks();
excelWorkBook = excelWorkBooks.add();
excelWorkSheets = excelWorkBook.worksheets();
excelWorkSheet = excelWorkSheets.add();
//excelApplication.visible(TRUE);
EDate = str2date('2050-01-01',321);
while select ldteExchRates where ldteExchRates.ToDate == EDate
{
lineNum++;
arr = new Array(Types::String);
range = excelWorkSheet.Range(strfmt("A%1:F%1", lineNum));
//arr.value( 1, num2str(ldteExchRates.ExchRate,18,2,0,0));
//if(LineNum==1)
// { SysExcelCell = ExcelWorksheet.cells().item(1,1);
SysExcelCell.value( "CurrencyCode");
SysExcelCell = ExcelWorksheet.cells().item(1,2);
SysExcelCell.value( "ExchRate");
SysExcelCell = ExcelWorksheet.cells().item(1,3);
SysExcelCell.value("FromDate");
SysExcelCell = ExcelWorksheet.cells().item(1,4);
SysExcelCell.value("ToDate");
// }
// else
//{
SysExcelCell = ExcelWorksheet.cells().item(lineNum,1);
SysExcelCell.value(ldteExchRates.CurrencyCode);
SysExcelCell = ExcelWorksheet.cells().item(lineNum,2);
exchRate = ldteExchRates.ExchRate/100;
SysExcelCell.value(num2str(exchRate,18,8,0,0));
SysExcelCell = ExcelWorksheet.cells().item(lineNum,3);
SysExcelCell.value( date2str(ldteExchRates.FromDate,321,2,-1,2,-1,4));
SysExcelCell = ExcelWorksheet.cells().item(lineNum,4);
SysExcelCell.value( date2str(ldteExchRates.ToDate,321,2,-1,2,-1,4));
// }
}
excelApplication.visible(TRUE);
}


Thanks
Mallik Gudidevuni

Sunday, 10 February 2008

Export data from Ax to Excel spread sheets.

This document addresses how to export Currency exchange rates data from Ax to Excel spread sheets.
Step1:
Click on
\Menus\Administration\Periodic\Data export/import\Excel spreadsheets\Template Wizard
This will open a new Wizard.
Step 2:
Click on Next Button

Step 3:
Give the file Path and file name to be created and Click Next Button.

Step 4:
· Select show all Tables radio button.
· Select Currency and ExchRates Tables and click on “>” Button. Then Click on Next Button.

Step 5:

Click Next Button.

Step 6:
Select the fields to be imported by expanding Table or just click on Next Button if you want full fields. By default all fields will be selected.

Step 7:
Click Next Button.
Step 8:
Check “Export Data” check box and Click Next Button.
Step 9:
Click on Finish Button this will show the excel file with the data.

Import and Export file from BLOB storage Account(Azure) in D365 F&O using X++

  Import and Export file from BLOB storage Account in D365 F&O using X++ Import: /// <summary> /// MKInventQualityOrderLineService...