cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Filter using Value List (Value Help)

jessicademarchi
Product and Topic Expert
Product and Topic Expert
1,276

Hi, Community

I have this data model:

entity Booking : cuid, managed {
bookingSkill : Composition of many BookingSkills
on bookingSkill.parent = $self;
bookingResource : Composition of many BookingResources
on bookingResource.parent = $self;
}
entity BookingSkills : cuid {
parent : Association to Booking;
skill : Association to Skill;
}
entity BookingResources : cuid {
parent : Association to Booking;
resource : Association to Resource;
}
entity Skill : sap.common.CodeList {
key code : Integer;
name : String(255);
descr : String(255);
}
entity Resource : cuid, managed {
name : String(255);
skills : Composition of many EmployeeSkills
on skills.resource = $self;
}
entity EmployeeSkills : cuid {
resource : Association to one Resource;
skill : Association to one Skill;
}

Annotating that in service:

entity Resource         as projection on ra.Resource;
entity Skill as projection on ra.Skill;
@cds.redirection.target
@Core.AutoExpand
entity BookingSkills as projection on ra.BookingSkills {
ID,
parent : redirected to Booking,
skill : redirected to Skill
};
@cds.redirection.target
@Core.AutoExpand
entity BookingResources as projection on ra.BookingResources {
ID,
parent : redirected to Booking,
resource : redirected to Resource
};
entity EmployeeSkills as projection on ra.EmployeeSkills {
ID,
skill,
resource : redirected to Resource
};

And I need to filter the skill selected in these SmartMultiInput:

Skill:

<smartMultiInput:SmartMultiInput value="{path:'bookingSkill/skill_code', templateShareable: true}" />

Resource:

<smartMultiInput:SmartMultiInput enableODataSelect="true" supportRanges="true" value="{path:'bookingResource/resource_ID', templateShareable: true}"/>

So I created this annotation:

annotate service.Skill with {
code @UI.Hidden @Common : {
Text : name,
TextArrangement : #TextOnly
};
};
annotate service.Resource with {
ID @UI.Hidden @Common : {
Text : email,
TextArrangement : #TextOnly
};
};
annotate service.BookingSkills with {
skill @(
title : 'Skill',
Common : {
Text : skill.name,
TextArrangement : #TextOnly,
ValueListWithFixedValues
}
);
};
annotate service.BookingResources with {
resource @(
title : 'Resource',
Common : {
Text : resource.name,
TextArrangement : #TextOnly,
ValueListWithFixedValues,
ValueList : {
$Type : 'Common.ValueListType',
CollectionPath : 'EmployeeSkills',
SearchSupported : true,
Parameters : [
{
$Type : 'Common.ValueListParameterIn',
LocalDataProperty : 'parent/bookingSkill/skill_code',
ValueListProperty : 'skill_code'
},
{
$Type : 'Common.ValueListParameterOut',
LocalDataProperty : 'resource_ID',
ValueListProperty : 'resource_ID'
},
{
$Type : 'Common.ValueListParameterDisplayOnly',
ValueListProperty : 'resource_ID'
}
]
}
);
};
annotate service.EmployeeSkills with {
resource @(
title : 'Employee',
Common : {
Text : resource.name,
TextArrangement : #TextOnly
}
);
skill @(
title : 'Skill',
Common : {
Text : skill.name,
TextArrangement : #TextOnly
}
);
};

But it doesn't work, the filter is not filtering.

Do you guys know where I'm doing wrong and how to correct that?

Thank you!

Accepted Solutions (0)

Answers (1)

Answers (1)

Yogananda
Product and Topic Expert
Product and Topic Expert
0 Likes

jessica.de.marchi

if you add UI.selectionFields which is going to enable filter search

UI.SelectionFields : [
        <fieldname to filter>,
    ]