Since I cannot find anything online, I'm hoping to tap into expert knowledge here...
I have a single entity with 3 options set columns in CDS, namely, Grade level, Genre, Format with their own internal IDs.
Goal
My goal is to have a text field with the concatenated corresponding label values such as (3 Writing Online) and not (100,003, 100,008, 100,010).
In the calculated form, the intellisense doesn't even show the options sets 😞
Any tips or example would be appreciated...
Easy with JavaScript. I wrote a function for you. You have to change the attribute names below to reflect your attributes.
You can call this function on the on-change event of the three option set attributes (adding the event handler). If you don't know how to upload JS & add an event handler, steps are described here:
function ConcatLabels(executionContext) {
var formContext = executionContext.getFormContext();
var gradeLabel= formContext.getAttribute("your_attribute_logical_name").getText();
var genreLabel= formContext.getAttribute("your_attribute_logical_name").getText();
var formatLabel= formContext.getAttribute("your_attribute_logical_name").getText();
var finalString = gradeLabel + genreLabel + formatLabel; // you can format your string here
//set the finalString to your attribute
formContext.getAttribute("your_attrbute_logical_name_to_set").setValue(finalString);
}
Please mark it as answer if my code helps.
Thanks
Satish Reddy
https://pascalcase.com
@HSheild I second that. The handler has to be added on on-change events, not on-load. I am editing my post.