Homelab, Linux, JS & ABAP (~˘▾˘)~

[CAP] min and max functions

Since there is nothing in the official CAP documents about min and max functions, I figured out the following syntax:

    const result1 = await cds.run(`SELECT *, MAX(counter) FROM ${myTable} LIMIT 1`) //returns array

    const result2 = await SELECT.one.from(myTable, [`MAX(counter)`]).columns('*') //returns object 

    const result3 = await SELECT.one.from(myTable).columns('MAX(counter)') //returns object containing only the max counter value

[CAP] CQL Expand Composition / Deep read

In the documentation they always use a star in string literals like this o => o.`*` to select all fields, but when running this it always failed. However, after some tests I found that this format works with brackets o => o.('*')


entity myEntity: cuid, managed {
    field1          : String;
    comp            : Composition of one myComposition;
aspect myComposition: cuid, managed {
    myCompField: String;
        const result = await SELECT.from(myEntity)
            .columns(e => {
                e.comp(c => c.myCompField) //expand composition, but only select 'myCompField'