cancel
Showing results for 
Search instead for 
Did you mean: 

CAP fiori annotations for SelectionFields not filtering data

js2
Product and Topic Expert
Product and Topic Expert
0 Kudos

I have annotations added to my CAP service like so:

UI: {
        SelectionFields: [
            status_code,
            category_code,
            priority_code
        ],

        LineItem: [
            {Value: title, ![@UI.Importance]: #High},
            {Value: status.code, ![@Common.Label] : 'Status', ![@UI.Importance] : #High},
            {Value: lti},
            {Value: location},
            {Value: description},
            {Value: category.name},
            {Value: priority.name}

...

When I run the CAP application and try to filter on any of the selection fields - the filter is ignored and all values are still shown in the list report table.

However, if I run the "fiori preview" for my entity - the filters work. Any ideas?

david_kunz2
Advisor
Advisor
0 Kudos

Hi Jason,

Can you tell us the HTTP request in both the working and non-working example?

Thanks and best regards,
David

js2
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi david.kunz2

This is the GET request after entering filter values - you can see that none of them are added to the odata filter property:

GET Incidents?$count=true&$select=HasActiveEntity,HasDraftEntity,ID,IsActiveEntity,description,location,lti,title&$expand=DraftAdministrativeData($select=DraftUUID,InProcessByUser,LastChangedByUser),category($select=code,name),priority($select=code,name),status($select=code)&$filter=(IsActiveEntity%20eq%20false%20or%20SiblingEntity/IsActiveEntity%20eq%20null)&$skip=0&$top=30<br>

Same request from the CAP fiori preview:

GET Incidents?$count=true&$select=HasActiveEntity,HasDraftEntity,ID,IsActiveEntity,description,location,lti,title&$expand=DraftAdministrativeData($select=DraftUUID,InProcessByUser,LastChangedByUser),category($select=code,name),priority($select=code,name),status($select=code)&$filter=(IsActiveEntity%20eq%20false%20or%20SiblingEntity/IsActiveEntity%20eq%20null)%20and%20category_code%20eq%20'database'&$skip=0&$top=30<br>

You can see "category_code" is added to the filter query here.

So how can this be if the annotations in the CDS service are exactly the same.

If the fiori preview (and normally in any fiori elements app) as soon as you change teh app state by entering a filter value the table gets a grey overlay. This doesn't happen when running the app served in the /app folder directly.

Even the default "editing status" selection option that fiori elements adds (without me adding any selection annotations) doesn't work.

I've tried with a couple of different UI5 versions (included the latest) as well but its the same.

I've also noted that the "adapt filters" link doesn't work - in that you cannot change the filters from it.

david_kunz2
Advisor
Advisor
0 Kudos

Hi Jason,

Thanks! Looks like some issues with Fiori Elements, can you remove the CAP tag and add the Fiori Elements tag? Thanks a lot!

Best regards,
David

js2
Product and Topic Expert
Product and Topic Expert
0 Kudos

david.kunz2 thanks for taking a look.

Interestingly I just used the fiori-tools yeoman generator (@sap/fiori-elements) to create a new fiori elements app inside the /app folder and added in the odata v2 proxy and it all works perfectly.

I think there is something amiss with the sap.fe templates and odata v4. When I watch any videos on using these sap.fe fiori elements odata v4 templates I notice that no one actually tests the filters work. 😉

I did have a discussion with that team a little while ago where they said they were not released for productive use yet...

Accepted Solutions (0)

Answers (0)