cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Regular Visitor

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
Highlighted
Community Support
Community Support

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
Highlighted
Community Support
Community Support

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
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

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