cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
RTW
Level: Powered On

Expand a collection based on qty

Let's say I have a collection that contains the desired composition for a team of adventurers that I need to go rescue the princess, which looks like this.

 

-----------------
| Qty |  Class  |
-----------------
|  1  | Wizard  |
|  1  | Cleric  |
|  2  | Ranger  |
|  2  | Fighter |
-----------------

I would like to be able to expand it by the amount listed in the quantity column, so that I can create a signup sheet to post in the local tavern, which would look something like this.

 

------------------
|  Class  | Name |
------------------
| Wizard  |      |
| Cleric  |      |
| Ranger  |      |
| Ranger  |      |
| Fighter |      |
| Fighter |      |
------------------

Now, depending on the adventure, I may have more or fewer spots to fill, but the schema would stay the same. I would not have a class repeated twice in the same list.

 

What would be the best way to go about doing this?

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Expand a collection based on qty

Hi @RTW ,

I'm afraid it's not supported to make this currently.

For now, there's no function that can specify insert times in PowerApps.

I suggest you express your views on PowerApps Ideas Forum. Your precious advice will be very helpful for our work.

https://powerusers.microsoft.com/t5/PowerApps-Ideas/idb-p/PowerAppsIdeas

As an alternative way, I suggest you create table2 first.

And then you could use groupby funtion to turn table2 to table1.

 

Best regards,

Community Support Team _ Phoebe Liu

 

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
2 REPLIES 2
geneZebra
Level 8

Re: Expand a collection based on qty

I am thinking adding a collection or table (called tempNames_or_Collection) for the names, etc that refers to the first table (called ClassTable). If you need to merge them back into one table use the AddColumns function based on filter on the new table. Something like AddColumns(ClassTable, "names", filter (tempNames_table_or_Collection, className =  ClassTable[@Class])). This should result in a collection where  the names col is an embedded table.

 

I believe their is also a groupBy function that can be used but it would mean that still need to create a table with duplicate class names befor you do the GroupBy. I find a separate table for the varying amount of (name) items is probably easier to deal with and if needed merge them together with the AddColumns function. Just have a common key to look up values between the two tables.

 

Community Support Team
Community Support Team

Re: Expand a collection based on qty

Hi @RTW ,

I'm afraid it's not supported to make this currently.

For now, there's no function that can specify insert times in PowerApps.

I suggest you express your views on PowerApps Ideas Forum. Your precious advice will be very helpful for our work.

https://powerusers.microsoft.com/t5/PowerApps-Ideas/idb-p/PowerAppsIdeas

As an alternative way, I suggest you create table2 first.

And then you could use groupby funtion to turn table2 to table1.

 

Best regards,

Community Support Team _ Phoebe Liu

 

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Users Online
Currently online: 153 members 4,417 guests
Please welcome our newest community members: