CDS-与深度关联的Count(*)问题

时间:2019-06-14 08:08:26

标签: sap-cloud-platform

有关联时,我无法计数(*)。需要对此要求的建议。

实体LandscapeObjects

@Core.Description: 'entity set containing all kinds of landscape objects'
@Core.LongDescription: 'you can use ?$filter=modifiedAt gt datetimeoffset2019-03-15T14:00:00Z to filter on recently modified objects (time stamp in single quotes)'
entity LandscapeObjects : managed {
  key id : UUID not null;
  name : LandscapeObjectType;
  description: String(256);
  objType  : String(64);
  customerNumber: String(64);
  networkSegment: Association to LandscapeObjects;
  source: String(64);
  properties: Composition of many Properties on properties.owner = $self;
};

实体连接

@Core.Description: 'associations between landscape objects'
entity Connections {
  key parent: Association to LandscapeObjects;
  key child: Association to LandscapeObjects;
  role: String(64);
};

查看BusinessServices1

@readonly view BusinessServices1    as select from landscape.LandscapeObjects {
        key id, 
        name,
        description, 
        customerNumber,
        networkSegment,
        properties[name='useCase'].value as useCase
         } where objType = 'BusinessService';```

查看BusinessServices2

@readonly view BusinessServices2    as select from BusinessServices1 left join landscape.Connections on BusinessServices1.id = Connections.parent.id {
        key BusinessServices1.id,
        BusinessServices1.name,
        BusinessServices1.description,
        BusinessServices1.customerNumber,
        BusinessServices1.networkSegment,
        useCase,
        count(*) as totalConnections : Integer
         } group by BusinessServices1.id,
         BusinessServices1.name,
         BusinessServices1.description,
         BusinessServices1.customerNumber,
         BusinessServices1.networkSegment,
         useCase;

问题:视图BusinessServices1视图有效,但是由于Connections.parent.id(非托管关联?),BusinessServices2无法正常工作

在数据库部署期间,它失败并显示错误

消息:“不能在打开条件的定义中使用非托管关联”

在这种情况下,您能否协助我获取连接列表?

0 个答案:

没有答案