diff --git a/cds/cdl.md b/cds/cdl.md index 48cad8ff5..0f117c6ed 100644 --- a/cds/cdl.md +++ b/cds/cdl.md @@ -1154,7 +1154,7 @@ entity P_Authors as projection on Authors { In this example, in addition to `books` projection `P_Authors` has a new association `availableBooks` that points only to those books where `stock > 0`. -If the filter condition effectively reduces the cardinality of the association +If the filter condition effectively reduces the cardinality of the association (or composition) to one, you should make this explicit in the filter by adding a `1:` before the condition: ```cds @@ -1164,6 +1164,12 @@ entity P_Employees as projection on Employees { } ``` +::: warning `:1` doesn't itself reduce the cardinality +The `:1` syntax itself has no effect on the cardinality. It is only an information by the developer +that the specified condition reduces the cardinality of the association or composition to one. +::: + + Filters usually are provided only for to-many associations, which usually are unmanaged. Thus publishing with a filter is almost exclusively used for unmanaged associations. Nevertheless you can also publish a managed association with a filter. This will automatically diff --git a/cds/cql.md b/cds/cql.md index 3e2abae87..dfe91df2b 100644 --- a/cds/cql.md +++ b/cds/cql.md @@ -354,6 +354,11 @@ If an infix filter effectively reduces the cardinality of a *to-many* associatio SELECT name, books[1: favorite=true].title from Authors ``` +::: warning `:1` has no effect on result set +The `:1` syntax in the filter has no effect on the result. It is only an information by the developer +that the specified condition reduces the result to a single entry. +::: + ### Exists Predicate Use a filtered path expression to test if any element of the associated collection matches the given filter: