Export to Excel Option in Report

Scott_MejaScott_Meja Member Posts: 30
For report with Export to Excel option, I need to show one field i.e.,Cost field different from that of the print preview report. The condition is if the level=1 then the values should be displayed in the Cost field same as in the print preview of the report and if the level= 2, then in the excel file the cost should not show any values for that field, it should display only zeros, that i did it, in OnPresection of that respective header, like if level=1 then ExporttoExcel(rowno,FORMAT(cost)), this is working fine.

For the same Cost Field, i have to display total of cost field, that should be different from that of the Printpreview report because if level=1 then cost may have different values and level=2 then cost =0,but my report is showing cost value in excel file same as print preview of the report. what condition should i include? please help me. can any one advice how to do it?

Comments

  • David_SingletonDavid_Singleton Member Posts: 5,479
    Scott Meja wrote:
    For report with Export to Excel option, I need to show one field i.e.,Cost field different from that of the print preview report. The condition is if the level=1 then the values should be displayed in the Cost field same as in the print preview of the report and if the level= 2, then in the excel file the cost should not show any values for that field, it should display only zeros, that i did it, in OnPresection of that respective header, like if level=1 then ExporttoExcel(rowno,FORMAT(cost)), this is working fine.

    For the same Cost Field, i have to display total of cost field, that should be different from that of the Printpreview report because if level=1 then cost may have different values and level=2 then cost =0,but my report is showing cost value in excel file same as print preview of the report. what condition should i include? please help me. can any one advice how to do it?

    Put the different number in a different column, then just add a standard Excel =SUM(A1:F15) type function at the end.
    David Singleton
  • Scott_MejaScott_Meja Member Posts: 30
    Hi David,

    Thank you for your prompt reply. I didn't get you what u replied. Could u please explain me in detail. Is the SUM allowed in navision?
  • David_SingletonDavid_Singleton Member Posts: 5,479
    Scott Meja wrote:
    Hi David,

    Thank you for your prompt reply. I didn't get you what u replied. Could u please explain me in detail. Is the SUM allowed in navision?
    Sure, just add it in the excel buffer as a formula and it will work in excel to sum up the column. The letter part is pretty easy, because the column are normally fixed. The number just track the row number at the beginning and end of the column. So create a variable called StartRow and EndRow, and then ( say its the 10th column) add the following

    ExcelBuffer.formula := strsubstno('sum(J%1:J%2)',StartRow,Endrow);
    David Singleton
  • sunnyksunnyk Member Posts: 280
    You can use 2 variables to assign value of Cost field based on the condition.
Sign In or Register to comment.