[]
        
(Showing Draft Content)

Default Values in Template Cells

While working with GcExcel templates, some cells are displayed as blank in the final Excel report when they have no data or empty value in data source. To handle such cases, GcExcel provides ‘defaultValue’ (DV) property which sets the specified default value in template cells containing data fields. The specified default value for cells containing no data or empty value in data source can be viewed in the final Excel report.

Property

Data Type

Description

Example

DV (defaultValue)

String or Number

The default value to show when there is no data in data source.

{{ds.BaseAmount(C=B7*C6, defaultValue = 0)}}

{{ds.BaseAmount(C=C15*D14, defaultValue = "-")}}

The below template is created to maintain E-commerce sales of electronic goods and their revenues in different areas of a country. The 'ds.Revenue' field will display default value when no data is present in data source. You can also download the Excel template layout used in below example.

SetDefaultValue[Template].xlsx


When the template is processed, the default values are displayed in the final Excel report as shown below:


Note: The default value in template cells can not be displayed for function or expression fields.