cancel
Showing results for 
Search instead for 
Did you mean: 

Value Help for enum

Ashoka
Explorer
0 Kudos

aspect elementForAssessment {
key code : String enum {
Attachment;
Boolean;
Character;
Currency;
Date;
Numeric;
Object;
![Text Area]
}
};

entity AssessmentTypes {
FieldConfig : Composition of many {
elementaryTest : String;
}
}

I have the above configuration in my schema.cds file and i want to provide the value help for the field "elementaryTest" . Here the values for the value help should be the values which are there in the aspect "elementForAssessment " , so can anyone please help me with this issue? Answers will be appreciated!

Thanks & Regards,
Ashoka


Accepted Solutions (1)

Accepted Solutions (1)

Dinu
Contributor

You could take the approach in the sample application and define a code list.

using { sap.common.CodeList } from '@sap/cds/common';

entity BookingStatus : CodeList {
key code : String(1) enum {
New = 'N';
Booked = 'B';
Canceled = 'X';
};

};

then define the type as an association.

BookingStatus : Association to BookingStatus;

You will have to provide codes and texts in csv files.

Ashoka
Explorer
0 Kudos
Hello Dinu , i have implemented your solution for the issue , and it is working fine.
Ashoka
Explorer
0 Kudos
Thank you very much for the Response , Dinu.

Answers (0)