Skip to Content
0
Sep 15, 2023 at 08:00 AM

Fiori Elements: Entity group by not being loaded

83 Views

Hello

I have following setup.

  • In my schema.cds I defined an entity "Orders". This entity contains attributes such as: streetname, city, zipCode. I know this is not the best approach regarding normalization because there may be different orders which include the same address values (but this is not the matter of debate here ;))
  • In my service.cds I defined another entity "distinctAddresses". The goal here is to create an SELECT on the Orders entity and to return as the entity-name says the addresses DISTINCT.
    @odata.draft.enabled: false
    entity distinctAddresses as
        select from Orders {
            max(UUID) as UUID: UUID,
            customerName,customerStreet,customerCity,customerPostcode
        }
        group by
            customerName,customerStreet,customerCity,customerPostcode;

When I want to check the results lets say by opening: http://127.0.0.1:4004/appname/distinctAddresses I get a response which is perfectly fine. However, when I address the entity within a SAP Fiori Elements value help I receive following errors in the browser console. The entries are not being loaded. Here are two snippets. The first one shows the occuring errors, the second one show the code for the value help, which should be correct. I have similar setups in other projects.

Log-dbg.js:493 (...) Cannot read properties of undefined (reading '$Type') -
Log-dbg.js:493 (...) Cannot read properties of undefined (reading 'getCaseSensitive') -
Uncaught (in promise) Error: sap.ui.mdc.ValueHelp: No content found.
annotate service.Orders actions {
    loadAddress (
        UUID @(
            Common.Label: '{i18n>AddressTemplatePlaceholder}',
            Common.ValueList: {
                Label: '{i18n>AddressTemplatePlaceholder}',
                CollectionPath: 'distinctOrders',
                Parameters: [
                    {$Type: 'Common.ValueListParameterOut', ValueListProperty: 'UUID', LocalDataProperty : UUID},
                    {$Type: 'Common.ValueListParameterDisplayOnly', ValueListProperty: 'customerName'},
                    {$Type: 'Common.ValueListParameterDisplayOnly', ValueListProperty: 'customerStreet'},
                    {$Type: 'Common.ValueListParameterDisplayOnly', ValueListProperty: 'customerPostcode'},
                    {$Type: 'Common.ValueListParameterDisplayOnly', ValueListProperty: 'customerCity'},
                ]
            },
            Common.ValueListWithFixedValues: false
        )
    );
}