How to set the default value of a dropdown in powe

2019-07-24 15:33发布

问题:

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?

回答1:

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)


标签: powerapps