How to set the default value of a dropdown in powerapps

choba78 picture choba78 · Sep 14, 2016 · Viewed 12k times · Source

I have a dropdown in powerapps and need to set the default value

My Items property of my dropdown I have it linked to my data source which is an Azure table.

'[dbo].[ColorTable]'

One could see the contents simplified as the following

Table({ColorName:"red"; ID: "1"};{ColorName:"green"; ID: "2"}{ColorName:"blue"; ID: "3"})

although I have many more entries.

In my details edit screen I have the ID value in my main datasource. However I need to set the dropdown's default with this value, however the dropdown use the ColorName as it's value.

How do I set the dropdowns default ID value since its Value is ColorName and not ID?

Answer

choba78 picture choba78 · Sep 14, 2016

I have a workaround that works but in conjunction with saving the selected value back again it can conflict with the saving.

In the Default property of the dropdown I add the following code

LookUp('[dbo].[ColorTable]';ID=ThisItem.fk_ColorID;ColorName)