Export an file from Ax 2009.

Hi All

I want to export records from custTable to .csv file and want that my code will run on server side.

How I can achieve this using Classes.

Regards

Vaibhav Agrawal

Im not sure with my answer.Just try this…

CommaIo file= new CommaIo(FilePath+“filename.csv”,“w”);

container buffer;

DictTable dt = new DictTable(tableNum(YOURTABLE));

int fieldcount;

for (fieldcount =1 ;fieldcount <= dt.fieldCnt();fieldcount++)

{

buffer += [dt.fieldName(dt.fieldCnt2Id(fieldcount))];

}

file.writeExp(buffer);

while select YOURTABLE

{

buffer = ConNull();

for (fieldcount =1 ;fieldcount <= dt.fieldCnt();fieldcount++)

{

buffer +=[YOURTABLE.(dt.fieldCnt2Id(fieldcount))];

}

file.writeExp(buffer);

}

file.finalize();

mfmujahidmim.wordpress.com/…/

alfasith.blogspot.in/…/job-class-code-to-import-csv-excel-file.html

.CSV file means we can do in Job but Server side u should do with Morphix report

msdn.microsoft.com/…/cc967382(v=ax.50).aspx

try it