cancel
Showing results for 
Search instead for 
Did you mean: 
Subscribe

Hi,

I am facing an error while adding a multiple facets in annotation.cds file for a project. For single facets its working for multiple its not. The code which I have used is below plus adding an image of error.

Facets: [ { $Type: 'UI.CollectionFacet', Label: 'Info', Facets: [ {$Type: 'UI.ReferenceFacet', Target: '@UI.FieldGroup#Main', Label: 'Main Facet'} ] }, { $Type: 'UI.CollectionFacet', Label: 'Info 2', Facets: [ {$Type: 'UI.ReferenceFacet', Target: '@UI.FieldGroup2#Main', Label: 'Main Facet'} ] } ], FieldGroup#Main: { Data: [ { Value: OrderNo }, { Value: OrderDesc } ] }, FieldGroup2#Main: { Data: [ { Value: OrderNo }, { Value: OrderDesc } ] },

0 Likes
View Entire Topic
maryana_naboka
Product and Topic Expert
Product and Topic Expert
0 Likes

I would suggest to define a unique ID for each collection facet.

Facets                 : [
        {
            $Type  : 'UI.CollectionFacet',
            ID     : 'test',
            Label  : 'Info',
            Facets : [{
                $Type  : 'UI.ReferenceFacet',
                Target : '@UI.FieldGroup#Main',
                Label  : 'Main Facet',
            },

            ],

        },
        {
            $Type  : 'UI.CollectionFacet',
            ID     : 'test2',
            Label  : 'Info 2',
            Facets : [{
                $Type  : 'UI.ReferenceFacet',
                Target : '@UI.FieldGroup#Main2',
                Label  : 'Main Facet 2',
            }, ],
        },

    ],

BTW: you can also use just reference facets if you do not need extra grouping

    Facets                 : [
        {
            $Type  : 'UI.ReferenceFacet',
            Target : '@UI.FieldGroup#Main',
            Label  : 'Main Facet',
        },
        {
            $Type  : 'UI.ReferenceFacet',
            Target : '@UI.FieldGroup#Main2',
            Label  : 'Main Facet 2',
        }
    ],