I am working on SAP CAP Node.js project with Hana-cloud database, which is deployed to SAP BTP Cloud Foundry.
cds -v
@sap/cds: 7.3.0
@sap/cds-compiler: 4.3.0
@sap/cds-dk: 7.3.0
@sap/cds-dk (global): 7.3.0
@sap/cds-fiori: 1.1.0
@sap/cds-foss: 4.0.2
@sap/cds-mtxs: 1.12.1
@sap/eslint-plugin-cds: 2.6.3
Node.js: v18.14.2
CAP OData Service local response :
{
"@odata.context": "$metadata#Books",
"value": [
{
"ID": 17,
"title": "CAP - what's new in 2023",
"price": 29.99,
"author_ID": 999,
"email":[ "[email protected]", "[email protected]"]
},
{
"ID": 85,
"title": "CAP - New Features",
"price": 39.99,
"author_ID": 997,
"email":[ "[email protected]", "[email protected]", "[email protected]"]
},
{
"ID": 42,
"title": "CAP - Debugging",
"price": 59.99,
"author_ID": 900,
"email":[ "[email protected]", "[email protected]"]
}
]
}
To test Lambda operator query on "email" array field locally, below queries are used.
###
# Test 1
GET http://localhost:4004/browse/Books?
&$filter=email/any(d:d eq '[email protected]')
###
# Test 2
GET http://localhost:4004/browse/Books?
&$filter=email/all(d:d eq '[email protected]')
###
# Test 3
GET http://localhost:4004/browse/Books?
&$filter=label/any(r:contains(r,'abc'))
###
# Test 4
GET http://localhost:4004/browse/Books?
&$filter=label/any(r:startswith(r,'abc'))
All the above local test gives the same response as shown below :
Have gone through several post on Lambda operator's in SAP CAP and found that lambda operator works fine with HANA unlike SQLite DB but as seen from above, it is not working for me.
Please guide.
Regards.