Default value in drop-down reactive

I have a drop-down and I want to show a specific value from the database entity as it's default value. But, the specific record is present somewhere in between in the entity, so sorting the table on the basis of id will not help. So, how do I show that specific value from database as default value in drop-down.


For eg:

In my table I have records in the following order:

Id.     Name

1.        Cat

2.        Dog

3.        Monkey

4.         Elephant

Now, in my drop-down I want to show "Dog" as the default value. So, how can I do it?


Champion
Solution

Hi Runisha, 

You have to follow similar approach. 

If Dropdown local variable data type is text then give default value  "Dog".

If it is identifier and entity is not static entity, in this situation - you have to provide identifier. 

Let suppose you want to show Dog as default value in dropdown. SO you have to give Id of "Dog" in default value. We know it is 2. Use IntegerToIdentifier() built in function to convert 2 in identifier.  


Please check- Demo Screen and  attached OML.

Hope this help.

Thank you

Demo_X_3.oml

Hello Runisha,

What's your application type reactive or traditional?

If it's traditional then please check below post,

https://www.outsystems.com/forums/discussion/68576/how-to-set-several-default-values-for-dropdown-select/

In addition you can refer below document,

https://success.outsystems.com/Documentation/How-to_Guides/Front-End/How_to_order_and_set_the_default_value_in_a_combo_box

Hope it helps you.

Regards,

Ajit Kurane.

It is reactive application. I am using drop-down widget.

Thank you for the help.

Champion

Hi Runisha, 

You are using dropdown. So defiantly, you also have some variable that is holding the dropdown selected value. 

You just need to give default value of that variable..

Let suppose your local variable data type  is entity identifier, so give

Entities.Animals.Dog

as default value. 

If the data type of local variable is text. then default value will be "Dog".

Please check -  Demo screen  

Also check my attached OML.


Regards,

Rahul


Demo_X.oml

Hello Rahul, Thank you so much for your kind help. But can you please tell me how can I achieve the above outcome if my entity is not static. Because my  your local variable data type  is entity identifier, but the entity to which it is referred to is not static.

 

Champion
Solution

Hi Runisha, 

You have to follow similar approach. 

If Dropdown local variable data type is text then give default value  "Dog".

If it is identifier and entity is not static entity, in this situation - you have to provide identifier. 

Let suppose you want to show Dog as default value in dropdown. SO you have to give Id of "Dog" in default value. We know it is 2. Use IntegerToIdentifier() built in function to convert 2 in identifier.  


Please check- Demo Screen and  attached OML.

Hope this help.

Thank you

Demo_X_3.oml

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.