Skip to Content
0

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

Dec 27, 2017 at 11:14 AM

63

avatar image

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!

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Florian Pfeffer
Dec 27, 2017 at 08:29 PM
0

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

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Thanks a lot! It's working for me.

BR

0