cancel
Showing results for 
Search instead for 
Did you mean: 

Search functionality in Fiori elements List Report not working for Timestamp Fileds

parthasaradhi
Explorer

Hi Experts,

I have created a List Report application based on a CAP OData V4 service.

The problem I am facing is when I try to use Search List report with Date/TimeStamp my application is not getting filtered.

My entity looks like below:

entity Books: managed{

key ID: String,

name:String

}

So now when I try to perform search on createdAt, modifiedAt fields (which are timestamps from managed aspect) I am not able to filter the data.

Is there any annotation that I need to use to enable the search functionality for the fields createdAt, modifiedAt.

If I search other fields, I am able to get the data. But for Timestamp fields I am not getting the data .

In my application Date is getting displayed like below

Do let me know if any annotation needs to be implemented for this.

With Regards,

Partha.

gregorw
Active Contributor
0 Kudos

How would you expect to search for a specific timestamp using a free text field? I would suggest to use a data range field as a usable filter.

parthasaradhi
Explorer
0 Kudos

Hi Gregor,

Understood the point you mentioned. But I am trying one more approach where I am trying to add the createdAt field (which is from managed aspect of CAP) as a Selection field in the list report. When I am adding the field in the selection fields section via annotations it is not visible on the list report.

Then I added one more datetime field in the entity and added it to selection fields and it appeared on the list report. Then I used Capabilities.FilterRestrictions annotation to get date picker for this field.

Can't we expect the same behavior as mentioned above with createdAt,modifiedAt fields?

If I am missing anything in process of adding those as selection fields to the list report do let me know.

If there is any other work around to achieve this do suggest that as well!!

With Regards,

Partha.

Accepted Solutions (0)

Answers (1)

Answers (1)

Arley
Product and Topic Expert
Product and Topic Expert
0 Kudos

By default, the search is limited to elements of type String, excluding calculated or virtual elements. This is to improve the performance of search queries by default by favoring performance over convenience.

https://cap.cloud.sap/docs/guides/providing-services#using-cds-search-annotation

To include or exclude elements from the set of searchable elements in search queries, you can use the @cds.search entity-level annotation. For example:

@cds.search: { ID, name, createdAt, modifiedAt }
entity Books : managed {
key ID: String;
name: String;
}