Home » Empty columns in a PowerApps Collection

Screenshot of camera tool being selected in PowerApps

Empty columns in a PowerApps Collection

A Collection in PowerApps is a temporary table of data, that only exists in your app, and only while its open. When you use Collect you usually create all the data as you go. But you might need to leave some empty columns.

You can use the data in a Collection in the same way you might use an Excel spreadsheet, a SharePoint list or a SQL Server table: you can create Galleries, or Tables to show the data, or use the data to do calculations. Leaving empty columns means you can take your user back to add that data later.

Creating a Collection in PowerApps

You create a Collection using this kind of code:

Collect(CollectionName, {ColumnName1: Row1a, ColumnName2: Row1b}, {ColumnName1: Row2a, ColumnName2: Row2b})

This creates a Collection which looks like this kind of table:

ColumnName1 ColumnName2
Row1a Row1b
Row2a Row2b

Creating a Collection with empty columns

But I needed to create an app with some empty columns.

It would be a camera app, which lets you take a lot of photos quickly (by tapping on the Camera) and then displays those in a strip of small images along the bottom of the screen. You’re then taken to another screen where you can fill in some details (such as description and name) for each photo.

That second step involves creating the Name and Description columns in my Collection first, but leaving them empty.

If my Collection was to be called ‘Photos’ then the code would look like this:

Collect(Photos, {Image: Camera1.Photo, Name: "", Description: ""})

As simple as that: put all blank fields as quote marks. (‘Camera1.Photo’ is the photo that the camera takes when you tap or click it.)

Now we end up with a Collection called Photos like this:

Image Name Description
<photograph>
<photograph>

So that when I add my Gallery or Form on another page, I just make its Items attribute ‘Photos’. The app will create three fields in total, even though they have no data in them yet.

Leave a Reply

Your email address will not be published. Required fields are marked *