Skip to Content

SAP WEBIDE XSA: hdbcds Views: Include a Column with a Default value?

Hi,

is there a way to include a new field within a cds view with a default value.

No, this column doesn't exists within the table of this view.

Was trying like this:

context fhirViews {
    const resourceType : String(10) = 'Patient';
    view Patient as
        select from PATIENT
        { resourceType,
         ....}
  }

Was looking for it within the documentation, but couldn't find a sample.

https://help.sap.com/viewer/4505d0bdaf4948449b7f7379d24d0f0d/2.0.02/en-US/de9843e69bd14989b8a592cf3e6c95d7.html

Thanks!

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Dec 27, 2017 at 08:29 PM

    If you wanna use values defined via a const, you have to use a colon. Anotherway is of course to define the value inline.

    ...
    const resourceType: String(10) = 'Patient';

    view Patient as select from PATIENT {
    'Patient' as NewCol1,
    :resourceType as NewCol2,
    :resourceType // no alias
    }; ...

    Regards,
    Florian

    Add comment
    10|10000 characters needed characters exceeded