Excel Buffer - Change Column Name through Code

jugheadjughead Member Posts: 6
I am trying to change the column names when the Aged AR report is exported to excel in Dynamic NAV 5.1.

For example, when the data is exported to excel, I want the column heaading for PO number to be 'PO Number' instead of 'External Document No'

The code used to show this column is ExcelBuf.AddColumn("Cust. Ledger Entry".FIELDCAPTION("External Document No."),FALSE,'',TRUE,FALSE,TRUE,'');

Can anyone please help me with some suggestions?

Comments

  • SavatageSavatage Member Posts: 7,142
    jughead wrote:
    The code used to show this column is
    ExcelBuf.AddColumn("Cust. Ledger Entry".FIELDCAPTION("External Document No."),FALSE,'',TRUE,FALSE,TRUE,'');

    Then why not replace
    "Cust. Ledger Entry".FIELDCAPTION("External Document No.")
    to
    ExcelBuf.AddColumn('PO Number'),FALSE,'',TRUE,FALSE,TRUE,'');
    :-k

    is this code in the report?
  • jugheadjughead Member Posts: 6
    Thank you, Harry for the immediate reply.

    I tried changing that but I am getting an error message asking to initialize the variable.

    'You have specified an Unknown Variable. PO Number. Define the variable under Global C/AL Symbols'
  • KarenhKarenh Member Posts: 209
    this
    ExcelBuf.AddColumn('PO Number'),FALSE,'',TRUE,FALSE,TRUE,'');

    should be

    ExcelBuf.AddColumn('PO Number',FALSE,'',TRUE,FALSE,TRUE,'');


    remove the extra left paren
  • jugheadjughead Member Posts: 6
    Thank you very much!!

    It worked! I was able to rename a number of columns!
Sign In or Register to comment.