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 } ] },

Request clarification before answering.
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',
}
],
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vivek,
the obvious problem is the definition of the second field group.
If you have more than one FieldGroup, they should be uniquely identified through the Qualifier, not through the changes in annotation name. In your case, instead of defining FieldGroup2 #Main you should define FieldGroup #Main2.
Then of course change the reference to this group in the Facet target: instead of Target : '@UI.FieldGroup2#Main', use Target : '@UI.FieldGroup#Main2'
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.FieldGroup#Main2',
Label : 'Main Facet 2'
}]
}
],
FieldGroup #Main : {Data : [
{Value : OrderNo},
{Value : OrderDesc}
]},
FieldGroup #Main2 : {Data : [
{Value : OrderNo},
{Value : OrderDesc}
]},
I have also noticed that both of your groups contain the same fields.
Best Regards,
Mariana
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.