Search code examples
navisioncal

Alternating colors on navision reports i.e on lines alternating white and grey colors?


Is there any way to give the grey section header like General, Lines, Invoice, Shipment a different color? E.g. I want to be General a blue color, Lines a light blue color and so on.


Solution

    • introduce new global variable RowColor as Boolean
    • in the Dataset Designer under desired DataItem add new column, with Data Source set to RowColor and Name of your choice (I put the same: RowColor)
    • in the C/AL editor enter one line of code inside DataItem - OnAfterGetRecord() trigger: RowColor := NOT RowColor; // to invert the boolean with each row

    • in the report layout (I use Visual Studio) select the row with data and in the Properties find attribute BackgroundColor. Click and choose option Expression (on the bottom) and enter this line: =IIF(Fields!RowColor.Value, "#EFEFEF", "#FFFFFF")