Skip to Content
0
Dec 07, 2021 at 06:35 AM

List Report with a default range Date filter value (cds annotation)

936 Views Last edit Dec 12, 2021 at 05:48 PM 2 rev

Hi,Experts:

I need a date filter in the smartFilterToolBar,and set a default range date value. So I use the annotation with the following codes, but the '@Consumption.filter.defaultValueHigh' doesn't work.

@Consumption.filter.defaultValue: '20211201'
@Consumption.filter.defaultValueHigh: '20211207'//defaultValueHigh (doesn't work)
@Consumption.filter.selectionType: #INTERVAL
@EndUserText.label: 'Created Date'

And I can see the metadata contain the "FilterDefaultValueHigh"

metadata.png

Here is the result with the annotaion.

filter.png

I can only solve it by fiori-element extension.(ListReportExt.controller.js)

modifyStartupExtension: function(oStartupObject) {
	var oSelectionVariant = oStartupObject.selectionVariant;
	if (oSelectionVariant) {
		oSelectionVariant.removeSelectOption("CreatedDate");
		var iYear = new Date().getFullYear(),
		iMonth = new Date().getMonth() + 1,
		iDate = new Date().getDate();
		oSelectionVariant.addSelectOption("CreatedDate", "I", "BT", iYear + "-" + iMonth + "-" + 1, iYear + "-" + iMonth + "-" + iDate);
	}
}

Here is the result after extension.

filter2afterextension.png

annotaion-doc.png

Although through the extension I can solve it, but I want to know why the annotaion '@Consumption.filter.defaultValueHigh' doesn't work? Can someone Help me? Thanks!

Attachments

filter.png (37.5 kB)
metadata.png (80.8 kB)
annotaion-doc.png (164.5 kB)