cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Morke
Helper II
Helper II

ThisItem with multiple Collection Items

Hi

I'm trying to follow this tutorial:

 

http://powerappsguide.com/blog/post/generating-row-numbers

 

 

To show the row number of a collection in a gallery.

However, to use the value of that's tutorial colCollection.RowColumn, I need to put the colCollection in the "Item" property of the Data Card that's holding the gallery.

Since that data card is already using my main Collection in the "Item" property, I have to put both like this:

[mainCollection, colCollection]

However, this destroys my ThisItem references in the gallery that I use to show data from the Main Collection.


Is there a way of using two collections in the same Item property of a Data Card and be able to reference "ThisItem" to each collection?

3 REPLIES 3
timl
Super User
Super User

Hi @Morke 

To use this code, you would set the Items property of the gallery control to colCollection.

From within your data card, you'll be able to refer to the columns in mainCollection, in addition to the RowColumn column that you added.

That's what I expected, but the RowColumn is not being added to the Main Collection.
I think this is because this formula doesn't really add the column to the Main Collection, but just adds it to the Instance of the Main collection the formula is creating, so once the formula stops and creates the colCollection collection, the instance is deleted, and Main Collection stays as before

@Morke

Assuming that mainCollection contains your source data, the formula copies that data to colCollection, and includes a RowNumber column. The formula never modifies mainCollection, so it will always stay as before.

Therefore, to display the row number, you would set the Items property of your gallery control to colCollection, rather than mainCollection.

To specifically answer your question - is there a way of using two collections in the same Item property of a Data Card and be able to reference "ThisItem" to each collection - the answer to this is no. A gallery can only have a single data source - it is not possible to set the data source of a gallery to 2 separate collections.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,589)