Home » Errors

Category: Errors

Psalm manuscriupt drawing of a hedgehog

Rename a PowerApp: why is your app locked?

Microsoft really seem to have dropped the ball when you come to rename a PowerApp.

It’s a bizarre couple of hoops to jump through that don’t make sense, but if you want to rename a PowerApp it’s easy, even if it’s not intuitive.

The wrong (but obvious) way to rename a PowerApp

The problem with the obvious way to rename a PowerApp (File -> App settings -> Edit app name) is that you’ll end up with a message telling you your app is ‘locked’. And locked by your good self too!

Screenshot showing error message in PowerApps
Error message showing that this PowerApp is locked by me

The only way (that’s impossible at first glance)

Here’s the silly part. Why’s the app locked? Because you’re using it! But of course you’re using it, because you have to in order to get to the renaming screen… 🙁

The infuriating solution to this is that you must close the PowerApp in order to rename it. So: once you’ve got to the point of changing the name (I’m adding ‘test’ to the end of the existing name in the screenshot above), go to the PowerApp, which is still open in another tab or window.

Then click on ‘Close’ at the bottom of the File menu. It’s on the left.

Once you’ve closed the PowerApp, you might as well close the whole tab, as you won’t be needing it again.

Go back to the tab where you’ve been trying to rename the thing, and try again.

Success?!

I hope so. Then you just need to close the right hand sidebar by clicking on the X in the top right. Do that twice, because of course you should.

Now you’re at a screen where you’ll be able to re-open your PowerApp by clicking on ‘Edit’ next to its name.

Screenshot showing steps for renaming a PowerApp
Rename your app by following these two steps (nicely reversed to keep things as confusing as PowerApps itself)

So that’s it. To rename a PowerApp you need to open its Settings from within the open app. But you can’t rename an open app because it’s locked!

Just thank Microsoft that they made the settings open in a new tab so you could close your PowerApp easily!

Image: Hedgehog from BL Royal 2 B VII, f. 97v. The British Library. Public Domain.

Screenshot showing a dropdown being populated in PowerApps

The column “Value” of the table wasn’t found

I’ve found an odd error message in PowerApps which I can’t fathom. I can stop it happening, and so get the app working, but it looks like a bug.

When you populate a drop-down menu, you can hard code the items in it like this:

["First item","Second item","Third item"]

Alternatively, you can populate a dropdown using items in a column in your data source. Simply set the Items attribute of the Dropdown to the table name, e.g. ‘[dbo].[UserRoles]’ for a hypothetical tool where a user must state what kind they are from a predetermined list.

In the right hand sidebar, under ‘Advanced’, find the Data section and you’ll see something like this:

Screenshot showing a dropdown being populated in PowerApps
Populating a dropdown from a database table

Here the Value attribute shows all the columns in the UserRoles table. I have just two, one of which is a unique ID.

The column “Value” of the table wasn’t found

I kept getting this error message when I ran the app in Android and iOS:

The column "Value" of the table wasn't found

It took me a while to realise the link between this ‘Value’ and the Value attribute under Data!

Of course, Value isn’t a column in this table, nor will it likely be in any other table I use for a Dropdown (it’s a bit vague).

Changing the name of the column ‘UserRoles’ in my database to Value, it started showing the same message but complaining that UserRoles was now missing. Of course it was! And I certainly didn’t want to rename my column as ‘Value’ permanently.

What worked was to add an empty column named ‘Value’ in my database, allow nulls, and leave it like that. Well, it worked!

Not an ideal situation but I can’t see this as anything other than a bug. It always worked when I ran the app on the laptop I was building it on (a Surface Pro in case you’re interested in testing), but not the mobile apps.

If you’ve got any insight into this, please do let me know!

Screenshot of primary key being selected

The first argument of ‘Patch’ should be a collection

There’s an incredibly common – and infuriating – error message that I keep running into, so I’m making a note here so I don’t forget! If you see “The first argument of ‘Patch’ should be a collection”, and you’re stuck, I have a quick fix for you!

In PowerApps, a Patch command sends information to your database. So, for example, if your app is connected to a table called ‘[dbo].[FriendsList]’ and you want to change Monica’s phone number to 555-12345 (whether it’s blank at the moment or has an old number in there), you could add this code to the OnSelect function of a button:

Patch(‘[dbo].[FriendsList]’, First(Filter(‘[dbo].[FriendsList]’, Name = ‘Monica’)), {PhoneNo: “555-12345”})

In order, these commands:

  • Determine the ‘collection’ that a record is going into (in this case ‘[dbo].[FriendsList]’). A collection can be a database table, or a local collection built with the Collect() command, for example.
  • Find the First (assuming the only, but more of that another time) item in the ‘[dbo].[FriendsList]’ database table where the ‘Name’ column has ‘Monica’ in it
  • Fill in the ‘PhoneNo’ column of the table with “555-12345”

The first argument of ‘Patch’ should be a collection

So we know that the first argument of this Patch is a collection. So why the error?!

If you swear you have this correct (and I’ve sworn a lot over this when making PowerApps), but you’re still getting the message “The first argument of ‘Patch’ should be a collection” head to your database. For example, if it’s a SQL Server database, you can open SQL Server Management Studio (SSMS) and find your table. Right click on the table name in the Object Explorer and select ‘Design’.

You need to make sure your table has an ID column with a primary key. Right click on the column where the little black arrow is, and select ‘Set Primary Key’.

Screenshot of primary key being selected
Set your primary key by right clicking on the column to the left

Next, make the column the ‘Identity’ column. Do this by going to the bottom of the screen and finding ‘Identity Specification’ and clicking the little black arrow next to it. Then to the right of ”(Is Identity)’ click on ‘No’, to bring down the drop-down menu. Now you can click on ‘Yes’. This means your ID number will increase by one automatically each time you add a new record.

Screenshot of Identity Column being created
Turn the Identity Specification of your column to ‘Yes’

These two measures make sure each of your records can be distinguished from the next one, and your error message will be no more! Why that has anything to do with collections being missing is, for now, beyond me.

Damn Microsoft for its idiotic error messages!