qmacro / qmacro.github.io

MIT License
4 stars 4 forks source link

ISO content for common CAP types | DJ Adams #63

Open utterances-bot opened 8 months ago

utterances-bot commented 8 months ago

ISO content for common CAP types | DJ Adams

ISO content for common CAP types 12 Mar 2024 | 14 min read There's an NPM package that provides default content based on the ISO...

https://qmacro.org/blog/posts/2024/03/12/iso-content-for-common-cap-types/

andrew-barnard commented 7 months ago

Thank you for writing this up.

You wrote "I'm fond of the strong particle pairing of μέν ... δέ which I first learned about as an important construct in Ancient Greek, and I find myself often using the (English) equivalent ("not only ... but also")."
I guess it is similar to the German nicht nur ... sondern auch as in this example. Der zu vermittelnde Stoff wird nicht nur umfangreicher, sondern auch komplizierter. Sometimes one hears / reads nicht nur ... aber auch also.

qmacro commented 7 months ago

Yes, indeed it is! Although I especially like how the μέν ... δέ pairing is so succinct. Incidentally, that classic comedy duo Peter Cook and Dudley Moore had a radio comedy show in the late 1960's called Not Only But Also :-)

ashivadi commented 1 month ago

Thanks Marco. Great explanation. But adding this line does not actually result in publishedIn_code being auto-populated.

using from '@sap/cds-common-content';

My schema.cds:

using {
  cuid,
  Country
} from '@sap/cds/common';

namespace my.bookshop;

entity Books {
  key ID    : Integer;
      title : String;
      stock : Integer;
}

My publicationinfo.cds:

using from './schema';
using {Country} from '@sap/cds/common';
using from '@sap/cds-common-content';

extend my.bookshop.Books with {
    publishedIn : Country
};

in this blog you mention:

And what's the outcome of this? To find out, let's expand the core books data now to include values for the new publishedIn_code field at the persistence layer, so that the content of db/data/my.bookshop-Books.csv now looks like this:

ID;title;stock;publishedIn_code 1;Wuthering Heights;100;DE 2;Jane Eyre;500;HU

$curl     --silent     --url 'localhost:4004/odata/v4/catalog/Books?$expand=publishedIn'   | jq . 
{
  "@odata.context": "$metadata#Books",
  "value": [
    {
      "ID": 1,
      "title": "Wuthering Heights",
      "stock": 100,
      "publishedIn_code": null,
      "publishedIn": null
    },
    {
      "ID": 2,
      "title": "Jane Eyre",
      "stock": 500,
      "publishedIn_code": null,
      "publishedIn": null
    }
  ]
}

But publishedIn_code does not automatically get auto-populated in my.bookshop-Books.csv. I must be doing something wrong. Can you help me understand what is going on?