cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
New Member

Add column to single value table and populate with data while in ForAll loop

Hi everyone,

I am having a collection that can have multiple records in it. A collection has the following columns. 

colProducts.png

 

 

 

 

 

Products: Concatenated values from record columns.

RecordId: Generated unique identifier.

 

 

 

 

Clear(colProducts);
ForAll(
    Gallery2_1.AllItems,
    Collect(
        colProducts,
        {
            RecordId: RecordId,
            Products: Concatenate(
                If(
                    ThisItem.Sharepoint = "true",
                    "Sharepoint",
                    "false"
                ),
                ",",
                If(
                    ThisItem.Dynamics = "true",
                    "Dynamics",
                    "false"
                ),
                ",",
                If(
                    ThisItem.Office = "true",
                    "Office",
                    "false"
                ),
                ",",
                If(
                    ThisItem.PowerApp = "true",
                    "PowerApp",
                    "false"
                ),
                ",",
                If(
                    ThisItem.PowerBI = "true",
                    "PowerBI",
                    "false"
                ),
                ",",
                If(
                    ThisItem.Flow = "true",
                    "Flow",
                    "false"
                )
            )
        }
    ));

 

 

 

Next, I create a collection based on "Products" column so that each product is actually a new record. I am achieving this by using Split function. 

 

 

 

ForAll(colProducts, Collect(colProductsRecords, Split(Products, ",")))

 

 

 

BUT, I also want to add new column to collection "colProductsRecords", RecordId for each product record created, depending on the current iteration item.  Result should be this: 

colProductsRecords.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Thank you all for helping!

HappyShroom

1 ACCEPTED SOLUTION

Accepted Solutions
Super User III
Super User III

Hi @HappyShrooom ,

I cannot test this, but you might try 

ForAll(
   colProducts, 
   Collect(
      colProductsRecords, 
      AddColumns(
         Split(
            Products, ","
         ),
         "RecordID",
         YourRecordIDValue
      )
   )
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

View solution in original post

2 REPLIES 2
Super User III
Super User III

Hi @HappyShrooom ,

I cannot test this, but you might try 

ForAll(
   colProducts, 
   Collect(
      colProductsRecords, 
      AddColumns(
         Split(
            Products, ","
         ),
         "RecordID",
         YourRecordIDValue
      )
   )
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

View solution in original post

Hi @WarrenBelz , 

 

It works. Would have sworn I tried your approach, but maybe I missed something. In any case thank you for your help. 

 

HappyShroom

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (73,241)