CDS Annotations

CDS: UI Annotations – SearchdefaultSearchElement

Annotations enrich the CDS views but can be confusing as well. These series of blogs have my simplified explanation.

SearchdefaultSearchElement is used on top a column, so it can be used multiple times in a view. The possible values are true and false and the default value is true.

Syntax

@Search.defaultSearchElement : true
Or
@Search.defaultSearchElement : false

Explanation: If you have used the annotation Search.searchable as true in your consumption, then you need to define the columns on which the generic filter will apply. Search.defaultSearchElement as true set the column on which the filter is applied. You can apply this annotation on more than one columns.

Example


@Search.searchable : true
....
define view ZCDS_EXAMPLE .....
.....

@Search.defaultSearchElement : true
key field1,

@Search.defaultSearchElement : true
field2,

field3,
......

In this case, the general search will use field1 and field2 for filtering the data entered in the search bar. As evident from the example, this annotation should only be used with Search.searchable and in consumption view. This annotation can further be refined using the following annotations.

Search.ranking

Search.FuzzinessThreshold

Follow the link as 1 minute ends here 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *

error

Enjoy this blog? Please spread the word :)

Follow by Email
Twitter
LinkedIn
LinkedIn
Share