Query on making excel sheet of a report?

Hi All,

I amde a excel sheet of a report with the help of excel buffer table,but there is one problem come i.e the heading field comes after every single record,as follows

Vendor Name Purchase Balance

Vineet 1000000 50000

Vendor Name Purchase Balance

Rajiv 500000 70000

Please help me about what i have to change so that heading part comes once and all records come after that.

Thanks in advance

Well since we didn’t know how you created your report, then it’s difficult to say what you did wrong! [:)] And these Excel Buffer reports sometimes can be quite complex.

But you have to make sure that the header is only created once. If you report inserts the vendors on a normal dataitem in the OnAfterGetRecord trigger, then eventually create a variable to check if the Header has already been created, so that it should not do it again.

When you are running this in a Report, you should write the Header cells in the OnPreDataItem and the lines in the OnAfterRecord Trigger.

This result Looks like you are writing everything in the OnAfterGetRecord.

Alternatively you can set a variable when you have created the Header cells and check if that variable already has a value before writing the Header cells.

Can you show us the code in Vendor onAfterget record trigger?

you must have added header names code in Onaftergetrecord trigger…thats why each time header is also exported.

i did’t write anything in onaftergetrecord.i made a function makeexceldatabody and i call this function in vendor onpresection and the code i write in MAKEEXCELDATABODY is

ExcelBuf.NewRow;

ExcelBuf.AddColumn(‘VendorName’,FALSE,’’,TRUE,FALSE,FALSE,’’);

ExcelBuf.AddColumn(‘Purchase’,FALSE,’’,FALSE,FALSE,FALSE,’’);

ExcelBuf.AddColumn(‘Balance’,FALSE,’’,FALSE,FALSE,FALSE,’’);

ExcelBuf.NewRow;

ExcelBuf.AddColumn(Vendor.Name,FALSE,’’,FALSE,FALSE,FALSE,’’);

ExcelBuf.AddColumn(Vendor.“Purchases (LCY)”,FALSE,’’,FALSE,FALSE,FALSE,’’);

ExcelBuf.AddColumn(Vendor.“Balance (LCY)”,FALSE,’’,FALSE,FALSE,FALSE,’’);

Thanks

Well then I suggest that you split this function into two: a MakeExcelHeader and a MakeExcelDataBody, so that you can make sure only to call the header once!

Ya i did the same what you told me to do,i made two functions MakeExcelDataBody anf MakeExcelDataBody1 and i write the header code in MakeExcelDataBody and the body part in MakeExceldataBody1.but the output is same.

Call MakeExcelDataBody function in OnPreDataitem trigger and MakeExcelDataBody1 in OnAfterGetRecord trigger.

Thanku so much,now it works correctly.thanku to all of you