Setting Selected Text in a PA Dropdown

dropdownA common question that I’ve run into again lately is how can I set the Selected or Selected Text property of a dropdown control in a Canvas App when there is NO Selected property?  The key to solving this problem is understanding the interaction between two other aspects in Power Apps.  They are the default property of the Dropdown and the Reset() function in Power Apps.  Lets look at how each of these work and how they interact.

Dropdown Default Property

Setting the initial value in a dropdown is as easy as setting the default property of the control.  When the control first loads it will look at the default property to set the initial value of the controls. The problem is that once a user has interacted with the control the default setting will be ignored. This is where the Reset() function comes in.

Reset() Function

The Reset() function in Power Apps is specifically designed to reset a given control back to their Default settings.  Adding Reset(<<DropDown>>); to the end of an OnSelect that Patches or Submits a form will clear the user’s input and reset the Dropdown back to its original default value.

Try it Yourself

  1. Add a Dropdown and a Button to a Screen in a Power App
  2. Set the Default property of the Dropdown to “2”
  3. Type reset(Dropdown1) into the OnSelect Property of the Button

When you run the app the dropdown will default to 2. Use the dropdown to select 3 as the chosen value. Navigate to a different screen and back again.  The dropdown will be set to 3. Press the button.  The dropdown selected value will change to 2

This functionality works on most controls with minor variations.  Its the same for TextInput boxes, but for ComboBoxes you set DefaultSelectedItems to a record containing the value of the default selection.

Dataverse for Teams–Demo Code Solution

EduConPwrCon This post is a week overdue.  I was in Seattle last week to present 2 workshops and 3 talks.  One of the workshops and one of the talks was on how to use Dataverse for Teams. Many of the attendees asked if they could have a copy of the demos that I used during the talks. Below you will find a link to the solution that you can import into Power Apps in Teams to have copies of the Power App, Power Virtual Agent Bot, and Power Automate flows in the demo.  You can import the solution using the Power Apps client inside Teams.  Navigate to the Build Tab and select the See All link.

Dataverse4TeamsImport

Here’s the link to the Solution File:
https://www.dontpapanic.com/Download/Dataverse4Teams_1_0_0_3.zip

Renewed as an MVP for 14 years

July 1st came and went this year with a lot less uncertainty and dread. That’s because this year all MVPs were renewed for another year due to the lowered opportunities available during the pandemic. But even if I didn’t worry about it as much this year I was still just as excited to get the official notice that my MVP status has officially been re-awarded for the 14th year. I continue to feel honored and grateful for Microsoft’s recognition of my contributions to the community for another year.

But now its time to plan for the new year.  The Covid-19 pandemic shut down all in-person speaking events for almost 18 months  I have spoken at a couple virtual conferences last year, but I’m looking forward to in-person events starting up again later this summer. I’ll be traveling to Chicago to present at SPFest in a few weeks with two additional events later this fall.

Over the last year I’ve been spending a lot more time working with Power Apps and Power Automate, particularly as it applies to SharePoint and Teams.  In addition to being re-awarded as an MVP I continue as a Dual Super User in the Power Apps and Power Automate community forums. With the announcement last fall that SharePoint workflows are going away these two areas will become even more important for working with SharePoint online.

So here’s to another year as an MVP. I’m really looking forward to it.

13th Year as an MVP

mvp13July 1st is always a day that I both look forward to and dread.  That’s the morning I find out whether my MVP status has been renewed or not. I really started worrying this year when I saw lots of my friends and colleagues announce their re-awards at a little after 11:00 AM Eastern time.  By noon I was convinced that I had not been re-awarded. The one piece of hope that I tried to hold onto was that MS said they would send emails to all MVPs with the re-award decision whether they were re-awarded or not. With a sigh of relief I finally got my email around 12:30 Eastern time.  I’m not sure why my email was later than it has been in previous years, but it was a reminder to me how much I value being an MVP. I am particularly honored and grateful for Microsoft’s continued recognition this year.

But now its time to plan for the new year.  The Covid-19 pandemic has really cut into my time speaking at conferences, since most conferences have been cancelled or postponed.  But I have spoken at a couple virtual conferences this spring and as fall approaches it looks like I will have a busy schedule speaking at conferences that were postponed from earlier this year.

Over the last year I’ve been spending a lot more time working with Power Apps and Power Automate, particularly as it applies to SharePoint and Teams.  In addition to being re-awarded as an MVP I’ve also been named a Dual Super User in the Power Apps and Power Automate community forums. With the announcement last week that SharePoint workflows are going away these two areas will become even more important for working with SharePoint online.

So here’s to another year as an MVP. I’m really looking forward to it.

Filter on a Boolean in PowerApps

PowerappsOne of the spots where I see a lot of people being challenged when they first learn PowerApps is the concept of delegation. Delegation comes into play when working with data sources larger than 500 records. By default PowerApps is designed to only work on a maximum of 500 records at a time. You can increase this default setting to a maximum of 2,000, but that usually results in a noticeable performance lag in your PowerApp. To avoid that problem you should always limit the number of records you are retrieving from a data source to 500 records or less. One of the most common ways to do that is by using the Filter() function to limit the records being returned by the data source to a specific subset that you want to work on.

Using Filter() to limit the number of records retrieved from a specific data source is a great strategy, but it doesn’t always work. This is where understanding the concept of delegation becomes critical. Delegation is the process of having the data source filter the records before they are returned to the PowerApp instead of having the PowerApp apply the filter directly. This is complicated by the fact that not all data sources support delegation and different data sources support different logical operators for delegation. You can find a list of delegable data sources and operators here: https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/delegation-list. But even this documentation can lead to confusion.

The confusion comes in from some footnotes in the ‘Filter and LookUp delegable predicates’ section of the documentation. Footnote 3 on the logical operators reads, “For numeric columns, all operators can be delegated. For ID columns, only the ‘=’ can be delegated. Date columns can’t be delegated.” This would imply that all the operators should work with a Boolean value of true or false. But in my experience Boolean columns are treated the same way that ID columns are treated. The only operator that works is ‘=’. If you try to use a Filter statement where a Boolean value is not equal to something you will see that it issues a delegation warning. The following screenshot shows an example.

PowerApps1Blog

But if I change the formula to the Boolean being equal to true then the delegation warning goes away and the function becomes delegable. See the screenshot below.

PowerApps2Blog

The moral of the story is that understanding the intricacies of delegation is critical when building PowerApps.