cancel
Showing results for 
Search instead for 
Did you mean: 

usage of cds.foreach in typescript

akuller
Participant
0 Kudos
318

Hi,

does anyone have a working example of cds.foreach? I always get error messages that it is a query3 and not query2.

 

Docu: https://cap.cloud.sap/docs/node.js/core-services#srv-foreach-entity

View Entire Topic
akuller
Participant
0 Kudos

The solution:

 

cds.foreach(cds.parse.cql("SELECT ID FROM db_table"), (each: table) => console.log(each.ID))

 

or pass a CQN object. Locks are currently not supported, see https://github.com/cap-js/cds-types/issues/331 & https://influence.sap.com/sap/ino/#/idea/335478/