cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
David27
Level: Powered On

Auto populate default selections in a new form based on other records

My user is asked a series of questions which determine whether they are routed to a "new" or a "edit" form. All responses are saved and recorded on the same Sharepoint list, which contains choice columns, text columns and date columns.

 

My simple "new" and "edit" versions of the form work as expected.

 

Here is where I run into trouble-

 

I would also like there to be a version of the form (which the user is routed to based on dropdown selections made on previous screens) which creates a new row (form mode new), but which auto-populates and locks for editing all but a few of the fields. These should still appear on the form, and should still populate the list.

 

For example, if my app was about food, on one dropdown the user has already indicated their task as "baking" and  on a second cascading dropdown "I want to bake pie". Suppose the entries in a "starch" column are always flour when the user is baking pie. To reduce their date entry burden, I want "flour" to appear on the form for the starch field, already grayed out, and locked for editing. 

 

For my text fields, I achieved my desired result. First, I unlock the data card that is auto-produced, delete it, add a new text input, and set the default property to:

 

Concat((Distinct(Filter('SP LIST DATA SOURCE', Task = Dropdown.Selected.Result), Starch)), Result, ",")

 

It seems I had to add the "concat" piece to trick PowerApps into gathering the data as text, rather than pointing it to a record which breaks the logic. 

 

This same method does not work for "choice" or "date" columns. I can delete the data card and add a new text input which filters and displays the distinct values based on the logic I need, but this does not update the column in the list when I submit the form. I've tried everything I can think of. 

 

I can't figure out how to incorporate "date" or "choices" into the function, and it seems that the "look up" functions etc, are set up to edit an existing record, etc, not to copy information from an existing record and set that info as the default for a new record. I have too much data to manually set all of the cases (ie, If (dropdown = bake_pike {value: flour}), that's why I need to point it to the records referenced by dropdowns. 

 

Thanks!

 

1 ACCEPTED SOLUTION

Accepted Solutions
Microsoft v-siky-msft
Microsoft

Re: Auto populate default selections in a new form based on other records

Hi @David27 ,

 

To Choices field, there is no need to delete the datacard and add a text field, you first set the control type to View Selection, second unlock the data card, then set the DefaultSelectedItems property, the data card will in View mode with specific selection with no need to modify the Update property

 

To Date field, the above solution doesn't make sense, you need to delete the datapicker control and add a label in the data card, set the Text property, then set the Update property of data card to DateTimeValue(Label1.Text).

Snipaste_2020-01-07_17-06-50.png

Sik

View solution in original post

1 REPLY 1
Microsoft v-siky-msft
Microsoft

Re: Auto populate default selections in a new form based on other records

Hi @David27 ,

 

To Choices field, there is no need to delete the datacard and add a text field, you first set the control type to View Selection, second unlock the data card, then set the DefaultSelectedItems property, the data card will in View mode with specific selection with no need to modify the Update property

 

To Date field, the above solution doesn't make sense, you need to delete the datapicker control and add a label in the data card, set the Text property, then set the Update property of data card to DateTimeValue(Label1.Text).

Snipaste_2020-01-07_17-06-50.png

Sik

View solution in original post

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

New Badges

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors
Users online (5,189)