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
Welcome to Solutions for AX DEV — a dedicated space for developers and consultants working with Microsoft Dynamics AX / D365 F&O (D365 F&O). This blog contains a collection of frequently used code snippets, development tips, and practical solutions related to AX (Axapta). Whether you're working with X++, you'll find helpful content tailored to your development needs. Have a question or need help with something Feel free to post your it.
Subscribe to:
Post Comments (Atom)
Secure API Integration in D365FO Using OAuth2 and Azure Key Vault (X++)
Secure API Integration in D365FO Using OAuth2 and Azure Key Vault (X++) Integrating with external APIs securely is a common requirement in...
-
It is very common to use Like Operator in SQL SELECT column1, column2, ... FROM table_name WHERE columnN LIKE pattern ; N...
-
In the below example we will see how we can get the default financial dimension values from Purch line table. Here we are using AxdDimensi...
-
Get temp data from class to form Data source AX 2012 + X++ In the below example we will see how we can use the temporary table as form da...
No comments:
Post a Comment