cancel
Showing results for 
Search instead for 
Did you mean: 

CQN subquery not working for local/external services in CAP

David21
Explorer
0 Kudos
90

Hello everyone,

I'm using CAP(Node.js) with odata(v4) & fiori elements. I'm trying to use CQN subqueries and execute them at service level i.e. using srv.run(query) , srv here is a service object created by cds.connect.to('ServiceName'). According to Capire documentation you can use a query as source in the from property : https://cap.cloud.sap/docs/cds/cqn#from

This works but only when you run the query using cds.run(query). My requirement is to execute the query in other services i.e. srv.run(). But when i try doing that it gives the following error : [cds] - TypeError: Cannot read properties of undefined (reading 'map')

And when you click on the file( resolveView.js i.e. an internal file) that the error is referring to, it shows the following code , error is on line 653: 

community.png

 Seems like it expects an object with ref property as key and an array as value i.e from = {ref : ['TableName']}, and works only if the source is a table & not another query. Is this the default behavior and is there any way around it ? 

Accepted Solutions (0)

Answers (0)