[Working with scripts]: Handling NULL Values in CSV

Whenever there’s a null value in the data, the null values will be ignored when rendered to CSV output.
Example of CSV output when row 2 has a null value:

Col1,Col2,Col3,Col4
Col1,Col3,Col4

This case, you need to implement a WhiteSpace when the value is null in the DataField element
Example:

if (Col2 == null )
    { " "; }
else
    Col2;

To ensure it is consistent, you need to implement this condition to ALL DataField elements (Col1, Col2, Col3, Col4).
This is good for a report that has a few fields and you will be able to control each individual fields separately, but can be very tedious if there are many fields.

=========================================================================

Another simpler approach is to implement scripts to process the records to tackle reports that have many fields.
This can be done by adding this script in Detail “OnRenderBegin”

var rec = Data.getDataRecord();
var data = rec.getData();
for (var i=0;i<data.length;i++)
{
 if (data[i]==null) data[i]=" ";
}

This will substitute all null values with " " in the Detail section.