Export formula to Excel

Dear all,

Good day.

we have Demandforecasting Application,in this application we have form called GMAdjustment,Avgmonthsales,gmadjustment ,demandforecast for this week .these are the columns:

formula is :

Demandforecast = Avgmonthsales + (GMadjustment /100) * Avgmonthsales)

  • GMAdjustment ismanual entry,while entry the adjustment values are dynamically values are changed in Demandforecasted column .this has been done in ax level.

we need export this form as excel the same formula has been to export?

is it possible to do in AX?

please help me on this?

Writing Data to Excel file

How it works

  1. Use SysExcelApplication class to create excel file.

  2. Use SysExcelWorkbooks and SysExcelWorkbook to create a blank workbook(by default 3 worksheets will be available).

  3. Use SysExcelWorkSheets to select worksheet for writing data.

  4. SysExcelCells to select the cells in the excel for writing the data.

  5. SysExcelCell to write the data in the selected cells.

  6. Once you done with write operation use SysExcelApplication.visible to open

file.

static void Write2ExcelFile(Args _args)

{

InventTable inventTable;

SysExcelApplication application;

SysExcelWorkbooks workbooks;

SysExcelWorkbook workbook;

SysExcelWorksheets worksheets;

SysExcelWorksheet worksheet;

SysExcelCells cells;

SysExcelCell cell;

int row;

;

application = SysExcelApplication::construct();

workbooks = application.workbooks();

workbook = workbooks.add();

worksheets = workbook.worksheets();

worksheet = worksheets.itemFromNum(1);

cells = worksheet.cells();

cells.range(‘A:A’).numberFormat(’@’);

cell = cells.item(1,1);

cell.value(“Item”);

cell = cells.item(1,2);

cell.value(“Name”);

row = 1;

while select inventTable

{

row++;

cell = cells.item(row, 1);

cell.value(inventTable.ItemId);

cell = cells.item(row, 2);

cell.value(inventTable.ItemName);

}

application.visible(true);

}

I am assuming, all those columns are in form of grid with DataSource ‘Alpha’

Then I suggest

write a method on the data source ‘Alpha’ say ‘Calculation’.

display real calculation()

{

\Declare all the variables

real Demandforecast ;

Demandforecast = Avgmonthsales + (GMadjustment /100) * Avgmonthsales)

return Demandforecast ;

}

and

Create a field in Form Design for “calculationofDemandForecast”

and

then change field of property DataMethod to ‘calculation’;

Then try to Export to excel.

You should get the desired result.