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

SAP CAP ValueList Displaying a deep value list

Steve36
Explorer
0 Likes
319

This is my current code for the entity Trainee.

entity Trainee {
    key employee : Association to one Employee;
    currentlyLearning : Association to one lpn.LearningPlanEnrollment;
}

And this is the current code for the entity Employee (just so you guys can understand what I'm trying to do)

entity Employee : cuid {
    firstName    : String(100) @mandatory;
    lastName     : String(100);
    name         : String = firstName || ' ' || lastName;
    gender       : Gender @mandatory;
    email        : String(255) @mandatory;
    dateOfBirth  : Date @mandatory;
    batch        : Integer @mandatory;
}

What I'm currently trying to do is to create a value list inside a custom action where it displays all of the information of the employee from the Trainee entity. In other words, I want the value list to not only display the ID, but also the name, gender, email, dateOfBirth, and batch.

But using the annotation, I can't do it, as if the CDS couldn't read it. Instead, I can only reach this far.

... 
   },
    ) actions { 
        enrollTrainees(
            @Common.ValueList : {
                $Type : 'Common.ValueListType',
                CollectionPath : 'Trainees',
                Parameters : [
                    {
                        $Type : 'Common.ValueListParameterInOut',
                        LocalDataProperty : trainees,
                        ValueListProperty : 'employee_ID',
                    },
                ],
            }
            trainees
        );
    };
...

 Does anyone have a solution to what I'm trying to do? If using Fiori Elements not possible, is it possible using Fiori Freestyle? Thank you.

Accepted Solutions (0)

Answers (0)