cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
morall
Microsoft
Microsoft

Doing a join between a CDS & collection

I am creating a collection:

ClearCollect('oneEng_Candidates_2', ShowColumns('OneEng Candidates', "cr818_name", "cr818_generalstatus"));

and trying to join it with some data in an entity

 

 

ShowColumns(
    AddColumns(
        oneEng_Candidates_2,
        "Score",
        LookUp(Status_Scores, Name = oneEng_Candidates_2[@cr818_generalstatus], Score)),
     "cr818_name", "cr818_generalstatus", "Score"
)

 

 

 

or something simpler:

 

 

AddColumns(
    oneEng_Candidates_2,
    "Score",
    "Some info"
)

 

I am not getting any errors, but its not adding a column into the collection:

 

Screen Shot 2020-07-29 at 5.09.00 PM.png

 

Another sample test:

ClearCollect(varCollection, {col1: "some Data"});
AddColumns(varCollection, "col2", "More Data");




Screen Shot 2020-07-29 at 5.17.05 PM.png

 

What am I doing wrong?  

1 ACCEPTED SOLUTION

Accepted Solutions
v-xida-msft
Community Support
Community Support

Hi @morall ,

Based on the formula that you mentioned, I think you have some misunderstanding with the AddColumns function in PowerApps.

 

The AddColumns function would generate a new temporary table with transform applied, the underlying table would not be modified. When you apply the AddColumns function to your 'oneEng_Candidates_2' collection, it would generate a new temporary table, the original  'oneEng_Candidates_2' collection would not be changed.

 

On your side, please consider modify your formula as below:

ClearCollect(
             oneEng_Candidates_3,   // set up a new collection to store the ShowColumns function result
             ShowColumns(
                          AddColumns(
                                     oneEng_Candidates_2,
                                     "Score",
                                     LookUp(Status_Scores, Name = oneEng_Candidates_2[@cr818_generalstatus], Score)
                          ),
                           "cr818_name", "cr818_generalstatus", "Score"
            )
)

then the new added column would be shown up within the oneEng_Candidates_3 collection.

 

In addition, you could also consider try the following formula to set up your oneEng_Candidates_2 collection:

ClearCollect(
              oneEng_Candidates_2,
              AddColumns(
                         ShowColumns('OneEng Candidates', "cr818_name", "cr818_generalstatus"),
                         "Score",
                         LookUp(Status_Scores, Name = oneEng_Candidates_2[@cr818_generalstatus], Score)
              )
);

 

Please try above solution, hope it could solve your problem.

 

Regards,

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

View solution in original post

2 REPLIES 2
morall
Microsoft
Microsoft

you can't add columns in place, have to create a new collection

v-xida-msft
Community Support
Community Support

Hi @morall ,

Based on the formula that you mentioned, I think you have some misunderstanding with the AddColumns function in PowerApps.

 

The AddColumns function would generate a new temporary table with transform applied, the underlying table would not be modified. When you apply the AddColumns function to your 'oneEng_Candidates_2' collection, it would generate a new temporary table, the original  'oneEng_Candidates_2' collection would not be changed.

 

On your side, please consider modify your formula as below:

ClearCollect(
             oneEng_Candidates_3,   // set up a new collection to store the ShowColumns function result
             ShowColumns(
                          AddColumns(
                                     oneEng_Candidates_2,
                                     "Score",
                                     LookUp(Status_Scores, Name = oneEng_Candidates_2[@cr818_generalstatus], Score)
                          ),
                           "cr818_name", "cr818_generalstatus", "Score"
            )
)

then the new added column would be shown up within the oneEng_Candidates_3 collection.

 

In addition, you could also consider try the following formula to set up your oneEng_Candidates_2 collection:

ClearCollect(
              oneEng_Candidates_2,
              AddColumns(
                         ShowColumns('OneEng Candidates', "cr818_name", "cr818_generalstatus"),
                         "Score",
                         LookUp(Status_Scores, Name = oneEng_Candidates_2[@cr818_generalstatus], Score)
              )
);

 

Please try above solution, hope it could solve your problem.

 

Regards,

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

View solution in original post

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (2,400)