cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Edit Form - AllowedValues

I have a powerapp pointing to a sql azure table. 

The editform automatically created has textboxed for my text field which makes sense, but I would like some of them to be dropdowns with a handfull of options to pick from.

 

 

On the right pane you can edit the data elements. I am guessing I should change it to 'AllowedValues', but I can't see how to edit the list of values. Maybe I am way off here, but I can't find anything in the documentation for how to do it within a form control.

 

Please help?

1 ACCEPTED SOLUTION

Accepted Solutions
CarlosFigueira
Power Apps
Power Apps

The 'AllowedValues' card is used when the data source itself knows what are all the possible values (for example, an enumeration column in CDM). You can, however, customize the card to change the text input control to another more suitable for your needs, by unlocking the card.

 

Let's walk through it... I'll create an app from data from a SQL table that has a property that I want to restrict the values. Here's the edit screen for it:

01-Form.png

You can notice that the card has a small "padlock" indicating that it's locked and cannot be changed. With the card selected, click the '...' button and then click 'Advanced options':

02-ChooseAdvanced.PNG

Now click the padlock to unlock the card, to be able to change the controls used on it:

03-UnlockCard.PNG

You'll see that the padlock on the card name disappeared. Select the control that you want to delete (the text input). You'll notice that the advanced pane shows the control name (in this case, 'DataCardValue7') - take a note of this name as it will make it easier to correct some errors later.

04-SelectControl.PNG

Now delete the control. You'll notice that there will be some errors in the card, because that control was referenced by others.

05-ControlDeleted.PNG

Now add a new control (Insert -> Dropdown) while the card is selected (so that the control will be added as a child of the card. After adding it, click on the control name, and rename it to the name of the original control (in this example, 'DataCardValue7')

06-InsertAndRenameDropdown.PNG

Now go back to the advanced pane and update the 'Items' property to the list of values that you want to allow. Also update the 'Default' value to 'Parent.Default' so that it will show the current value for the record when it's being edited.

07-UpdateItemsAndDefault.PNG

Finally, select the card, and change its Update property to get the value from the dropdown. In this case, it's set to 'DataCardValue7.Selected.Value'

08-CardUpdateValue.PNG

And now your edit screen only shows the items from the "allowed values" for your scenario.

View solution in original post

5 REPLIES 5
CarlosFigueira
Power Apps
Power Apps

The 'AllowedValues' card is used when the data source itself knows what are all the possible values (for example, an enumeration column in CDM). You can, however, customize the card to change the text input control to another more suitable for your needs, by unlocking the card.

 

Let's walk through it... I'll create an app from data from a SQL table that has a property that I want to restrict the values. Here's the edit screen for it:

01-Form.png

You can notice that the card has a small "padlock" indicating that it's locked and cannot be changed. With the card selected, click the '...' button and then click 'Advanced options':

02-ChooseAdvanced.PNG

Now click the padlock to unlock the card, to be able to change the controls used on it:

03-UnlockCard.PNG

You'll see that the padlock on the card name disappeared. Select the control that you want to delete (the text input). You'll notice that the advanced pane shows the control name (in this case, 'DataCardValue7') - take a note of this name as it will make it easier to correct some errors later.

04-SelectControl.PNG

Now delete the control. You'll notice that there will be some errors in the card, because that control was referenced by others.

05-ControlDeleted.PNG

Now add a new control (Insert -> Dropdown) while the card is selected (so that the control will be added as a child of the card. After adding it, click on the control name, and rename it to the name of the original control (in this example, 'DataCardValue7')

06-InsertAndRenameDropdown.PNG

Now go back to the advanced pane and update the 'Items' property to the list of values that you want to allow. Also update the 'Default' value to 'Parent.Default' so that it will show the current value for the record when it's being edited.

07-UpdateItemsAndDefault.PNG

Finally, select the card, and change its Update property to get the value from the dropdown. In this case, it's set to 'DataCardValue7.Selected.Value'

08-CardUpdateValue.PNG

And now your edit screen only shows the items from the "allowed values" for your scenario.

This is great, thanks for the start.  I'm going to keep digging on this because I've already got a SQL table with controlled values to select, and want to create a data connection to draw those into the drop-down, rather than trying to update them inside the PowerApp.

Ohhhh so that's what enumeration does! I will have to try it

Microsoft Employee
@8bitclassroom

Hi, did you figure out a way to use your SQL table?

EJBriones
New Member

Hey @idajh ,
 
1. You can import the SQL table into data source. The excel table behaves the same

EJBriones_1-1654140779489.png

 



2. Use the table name in the Dropdown's Items Property

EJBriones_0-1654140749831.png

 

3. Select the card and change the Update property to TableName.Selected.ColumnName

EJBriones_2-1654140846059.png

 

Hope it works

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Users online (3,149)