Custom dropdown caption

0
Hi experts,In a dropdown list I want to show custom value like attribute1+attribute2 both are string from same table. I got stuck how to build this dropdown. Thanks in advance
asked
2 answers
1

Hi Sam,


There is a custom widget called as searchable selector which will solve your case. The dropdown is custom based on optional content.
I hope this helps


answered
0

The simplest and best-practice way is to not use the dropdown directly on the two separate attributes. A dropdown in Mendix normally shows one display value, so if you want to show attribute1 + attribute2, create a calculated string attribute or a helper attribute on that entity.


For example, add an attribute like DisplayName and fill it with something like: attribute1 + ' ' + attribute2. Then use that DisplayName as the caption in the dropdown.


If you need it to stay always up to date, you can do it in one of these ways:

1. Stored attribute + before commit logic

Set DisplayName in a microflow or event handler before saving the object.


2. Calculated attribute

Use a calculated attribute if you do not want to store it physically in the database.


If your dropdown is based on a reference selector or combo box, bind it to the entity as usual and configure the caption/display attribute to this combined field.


If this resolves the issue, please close the topic.



answered