What is the correct syntax to implement this?

You want to implement an event handler to show a console log once a supplier record is read.

What is the correct syntax to implement this?
A . const cds = require(‘@sap/cds’)module.exports = cds.service.impl(function () { const {Supplier} = this.entities() this.after(‘each’,Supplier, row =>{ console.log(`Read Supplier: ${row.ID}`)})})
B. const cds = require(‘@sap/cds’)module.exports = cds.service.impl(function () { const {Supplier} = this.entities() this.after(‘each’,Supplier, row =>{ output.log(`Read Supplier: ${row.ID}`)})})
C. const cds = require(‘@sap/cds’)module.exports = cds.service.impl(function () { const {Supplier} = this.entities()this.on(‘each’,Supplier, row =>{ output.log(`Read Supplier: ${row.ID}`)})})
D. const cds = require(‘@sap/cds’)module.exports = cds.service.impl(function () { const {Supplier} = this.entities() this.on(‘each’,Supplier, row =>{ console.log(`Read Supplier: ${row.ID}`) })})

Answer: C

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments