Options Datasource DropDown Display Value

Hello together,

i have a question regarding the Display Value in a Drop Down.

Example given:
Two entities with n-to-1 (Product to Productgroup) relationship. In the Product Editor Screen i have a DropDown of Product Groups. The Display Values of the Drop Down (using a Product Group Collection Datasource) are taken from the definition of the Instance Name of the Product Group Entity. How can i select just one attribute of the collections Datasource, in case i don’T want to use all of the Attributes, defined as the Instance Name.

I tried to select just one field, in the collections Datasource of the Product Edit Web Module. But this caused an error. something like “cant select single attribute” when opening the edit screen.

I can also add the complete Error if this helps, but i’m pretty sure you already have a solution for me.

Thanks in advance
Daniel

Hello Daniel,

You can select one attribute from the Instance name by using generator in the column.

generatedColumn

https://www.cuba-platform.com/discuss/t/how-to-use-multiple-attributes-in-namepattern-with-parent-classes/2220

See attaches above.

Thanks!!

Hi, @dannywall55s

to solve your problem you should set property caption mode for your field and set which property should be used as caption. Here is an example:

productGroupField.setCaptionMode(CaptionMode.PROPERTY);
productGroupField.setCaptionProperty("name");

Here is additional information in the documentation: link.

Regards,
Daniil.

1 Like