Skip to main content

Notifications

Power Apps - Building Power Apps
Answered

Combine two collections

Posted on by 10
Greetings , 
 
I have two choice column in my SP list , one column is Equipment Description and the other is EquipmentID , i have created two collections to get the data separately.
ClearCollect(
    colEquipmentDescriptions,
    Choices('NewLine Release Equipments'.'Equipment Description')
);
 
// Create a collection for EquipmentID choices
ClearCollect(
    colEquipmentIDs,
    Choices('NewLine Release Equipments'.EquipmentID)
);
 
The information is like this:
Equipment Description EquipmentID
LeakTester 2 ATEQ KERO-A1-1684
LeakTester 1 ATEQ KERO-A1-1683
EBC470 CaseUp Line KERO-A1-1682
Laser Welding - 1.2 KERO-A1-1681
EasyRouter KERO-A1-1680
MLL-3P + Extension KERO-A1-1679
EOL GM1 KERO-A1-1674
FCT KERO-A1-1664
Ebsomat 20-3 KERO-A1-1661
Surubelnita KERO-A1-1655
EOL Trane KERO-A1-1654
MUTE TERMINAL MACHINES KERO-A1-1632
 
 
How can i combine these two collections into one , the thing that i want to do in my app is that i have a combobox with the Equipment Description and i have a dropdown that i want to autopopulate the EquipmentID for the coresponding Equipment Description.
Please help because i ran out of ideas , i tried to get some info from AI but it doesn't help me.
 
Thank you in advance.
 
Categories:
  • StefanAndrasi Profile Picture
    StefanAndrasi 10 on at
    Combine two collections
    Hi WarrenBelz , 
     
    Worked like a charm , appreciate the help :)
  • Verified answer
    WarrenBelz Profile Picture
    WarrenBelz 143,297 on at
    Combine two collections
    I am now a bit unclear what you need - from your initial post you have a list called 'NewLine Release Equipments' that has two choice fields 'Equipment Description' and 'Equipment ID'. It appeared that you are wanting to create a collection showing these columns converted to text.
    However are these choices hard-coded in the list (541 of them ??) as choices on each item and you want the choice values available ? If so note you will need to increase your Data Row Limit to at least 541
    With(
       {
          _Data1: 
          ForAll(
             Sequence(CountRows(Choices('NewLine Release Equipments'.'Equipment Description'))),
             Patch(
                Index(
                   Choices('NewLine Release Equipments'.'Equipment Description'),
                   Value
                ),
                {No1: Value}
             )
          ),
          _Data2: 
          ForAll(
             Sequence(Choices('NewLine Release Equipments'.EquipmentID))),
             Patch(
                Index(
                   Choices('NewLine Release Equipments'.EquipmentID),
                   Value
                ),
                {No2: Value}
             )
          )
       },
       ClearCollect(
          colEquipment,
          ShowColumns(
             AddColumns(
                RenameColumns(
                   _Data1,
                   Value,
                   Equipment_Description
                ),
                Equipment_ID,
                LookUp(
                   _Data2,
                   No2 = No1,
                   Value
                )
             ),
             Equipment_Description,
             Equipment_ID
          )
       )
    )
     
    Please click Does this answer your question 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 a Like.
    MVP (Business Applications)     Visit my blog Practical Power Apps    Buy me a coffee

     
  • StefanAndrasi Profile Picture
    StefanAndrasi 10 on at
    Combine two collections
    Hi WarrenBelz , 
     
    Thank you for the answer , but unfortunately its not what i need , is getting only the first Equipment Description with the first EquipmentID , i need my collection to show them all , there are 541 entries for both Equipment Description and EquipmentID.
     
    I wrote this:
    ClearCollect(
        colCombinedEquipments,
        ForAll(
            colEquipmentDescriptions, // For each Equipment Description
            {
                EquipmentDescription: ThisRecord.Value, // The value of the Equipment Description
                EquipmentID: LookUp(
                    colEquipmentIDs,
                    Value = ThisRecord.Value, // Match the description with the ID
                    Value // Return the corresponding Equipment ID
                )
            }
        )
    );

     
    But the information is this , altough there are all the entries , i have the EquipmentID as blank , i have the first value in both column named Blank
  • WarrenBelz Profile Picture
    WarrenBelz 143,297 on at
    Combine two collections
    Try this structure
    ClearCollect(
       colEquipmentDescriptions,
       ShowColumns(
          AddColumns(
             'NewLine Release Equipments',
             Equipment_Description,
             'Equipment Description'.Value,
             Equipment_ID,
             EquipmentID.Value
          ),
          Equipment_Description,
          Equipment_ID
       )
    )
     
    Please click Does this answer your question 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 a Like.
    MVP (Business Applications)     Visit my blog Practical Power Apps    Buy me a coffee

     
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #7 Community Profile Tips…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,297

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 63,890

Leaderboard