on 2024 Feb 22 3:26 AM
Hi,
For example, I have a CAP service request: /helloworld/Users?$filter=companyCode eq '123456'.
I have implemented a custom handler for Users entity - READ.
I've been looking at Events and Requests | CAPire (cloud.sap) but I couldn't find any way to extract filter values. In this case, it is companyCode 123456
What is the correct way to extract filter values?
Regards,
Minh
Request clarification before answering.
Hi @MinhTriLe,
You can fetch the filter results from filterValue = req.query.SELECT.where || {}; and use JSON.stringify(filterValue) to get those in readable format we will get the filterValue in ref and values format like below:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Usually, you will have to extract these kind of information from the req.query, for you case, it should be req.query.SELECT.where, then you can extract these information.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Possibly a bit late to help you, but hopefully to help others who come across this question - a url query parameters string is available at `req._.req.query` which I personally find a lot easier to deal with than the CSN version. As a side note `req._.req` is the unmodified request object from Express.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
57 | |
10 | |
8 | |
8 | |
6 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.