cancel
Showing results for 
Search instead for 
Did you mean: 

usage of cds.foreach in typescript

akuller
Participant
0 Kudos
210

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
catano
Active Participant
0 Kudos

Hi @akuller ,

Is it possible that maybe you missed a single quote (') around your entity name?

Could you try it in the following way:

 

SELECT.from('Requests')

 

Regards,
Peter 

akuller
Participant
0 Kudos
Hi @catano I get the same error when I change it to ‘db_Requests’. Requests comes from the cds typer. Does it work for you?
catano
Active Participant
0 Kudos

Hi @akuller , it works for me. I just tried with the Standalone CDI with @cap-js/cds-typer 0.4.0. I receive no type error and no runtime error, foreach just runs with no problem.