Power Apps Exchange

Please login or click SIGN UP FOR FREE to create your PowerAppsUG account to join this user group.
 View Only
  • 1.  Combine 3 Columns into one Collection

    Posted Feb 24, 2022 05:23 PM

    Hi everyone. I'm new here. Hope I can get some assistance.

    Say I have a Sharepoint List with 3 Columns.
    Each column is just a simple multiline textbox that has each value split using a new line. (assuming that all columns will always have the same amount of rows)

    Column1:
    Apple
    Banana
    Carrot

     

    Column2:
    Fruit
    Fruit
    Vegetable

     

    Column3:
    Green
    Yellow
    Orange

     

    DesiredOutputCollection:
    Apple;Fruit;Green
    Banana;Fruit;Yellow
    Carrot;Vegetable;Orange

     

    I'm thinking something like this but can't think of the proper method.

    ClearCollect(
        DesiredOutputCollection,
        DropColumns(
            AddColumns(
                'My Sharepoint List',
                "3ColumnsCombined",
                Column1&", "&Column2&", "&Column3
            ),
            "Column1";"Column2";"Column3"
        )
    );


    ------------------------------
    Work Hard
    ------------------------------


  • 2.  RE: Combine 3 Columns into one Collection
    Best Answer

    Posted Feb 25, 2022 01:27 AM
    I just whipped up a test app real quick and got this to work. There might be a more optimized way to do this but it seems to work fine in my tests. Hope this helps!

    //Split each row in the text box into its own collection for easier reference in the ForAll loop
    ClearCollect(names, Split(TextInput1.Text, Char(10)));
    ClearCollect(types, Split(TextInput2.Text, Char(10)));
    ClearCollect(colors, Split(TextInput3.Text, Char(10)));
    ClearCollect(food, []);

    //Step through each index in the names column, adding the corresponding index values in the other collections to our new collection
    ForAll(Sequence(CountRows(names)),
    Collect(food, { name: Last(FirstN(names, Value)).Result, type: Last(FirstN(types, Value)).Result, color: Last(FirstN(colors, Value)).Result } ))

    ------------------------------
    Manny Baylor
    Director of Technology
    Project Chesapeake
    ------------------------------



  • 3.  RE: Combine 3 Columns into one Collection

    Posted Feb 25, 2022 05:18 PM
    Edited by Work Hard Feb 25, 2022 05:18 PM

    Hi @Manny Baylor. This worked beautifully. Thank you for taking the time to assist.

    I implemented this for a 7 column list with up to 20 rows each and it loads instantly.

    Thanks a bunch!



    ------------------------------
    Work Hard
    ------------------------------