i have seen many posts here on the subject of drop-downs but still cannot figure out how to do this. In DataCard14 I have a drop-down box in my New Form(DataCardValue14). The data source is the Events table. Events has a lookup field from the Homes table. I want a value from Homes to prepopulate this drop-down control as the default for the New Form.
Solved! Go to Solution.
Oops, I may have spoken too soon. I thought I tested this before and it worked, so I may have done something else that broke. Although my default values do indeed show up when creating a new entry, trying to submit the form via the standard "check" button returns an error: "The requested operation is invalid. Server Response: A value must be provide for item." Also, when I edit items in the EditForm, the previous records become replaced with my default items due to the Distinct() function.
Unfortunatley I cannot seem to "roll back" to before I had default items because there is a difference between what PowerApps generates and when you drag dropdown controls manually from the Content tab. (i.e., no Items field).
It sounds like the dropdown is not connected as the update value for that card, it should look like this DropdownName.Selected.Value. You may want to check that out. Also the default property should simply be ThisItem.ColumnName. If these are correct and you're still getting the error, this might help you get back to where you were before the change.
Thank you, setting the defaults back to ThisItem solved the issue with the Edit values switching to my defaults. So now I am back to not being able to set default values. I still see the Server error message when clicking the check box. I have checked all my fields for Defaults and Updates and they all seem to be correct. I am wondering if my context variable is causing the issue:
This context variable (galleryvar1) is in place because I have three galleries, each with their own navigation heading.
I should point out this happens when editing an existing item and also when trying to create a new item. So currently I cannot enter any data into my Sharepoint list via this app.
Not sure if the context variable has anything to do with that. You might want to duplicate your edit screen and use that as your new form. This will allow you to have the edit form keep it's values correct on the dropdowns, while also giving you a way to show default values in the new form. You might also try removing the items property from the duplicate and see if that fixes the server error.
I was able to restore the original dropdown boxes by deleting the data cards and creating new cards with dropdown controls. I then tried experimenting more wth the Distinct () function to try and restore the ability to have default choices for NewForm, but no luck.
Set the DefaultSelectedItems property of Dropdown control (showing Homes to the following formula:
KiranKr -- Thanks sooooo, sooo much! This same formula did it for me after hours of searching and trying! Really appreciate when people take the time to share their knowledge!