XMLPort - set column headers for the CSV file

I have created XMLPort to export data to CSV file in business central online.

My XMLPort contains both field elements and text elements.

How can I set column headers for my CSV file?

Parents
  • Export them in a separate table element.

    In C/AL visual designer it would be something like this:

    And the same in AL

    xmlport 50100 "Export G/L Entries W/Headers"
    {
        Format = VariableText;
        TableSeparator = '<NewLine>';
    
        schema
        {
            textelement(root)
            {
                tableelement(Headers; "Integer")
                {
                    SourceTableView = WHERE(Number = CONST(1));
    
                    textelement(EntryNoHeader) {}
                    textelement(GLAccNoHeader) {}
                    textelement(AmountHeader) {}
                }
    
                tableelement(GLEntry; "G/L Entry")
                {
                    fieldelement(EntryNo; GLEntry."Entry No.") {}
                    fieldelement(GLAccNo; GLEntry."G/L Account No.") {}
                    fieldelement(Amount; GLEntry.Amount) {}
                }
            }
        }
    
        trigger OnInitXmlPort();
        begin
            EntryNoHeader := GLEntry.FieldCaption("Entry No.");
            GLAccNoHeader := GLEntry.FieldCaption("G/L Account No.");
            AmountHeader := GLEntry.FieldCaption(Amount);
        end;
    }
    

Reply Children
No Data
Related
Recommended