cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
TempUser
Frequent Visitor

Add column from table A to table B

I have two tables (table A and table B) with equal length in sorted order, and I simply want to take a column from table B and add it to table A:


ideal table.PNG

The problem is that I get the whole column from table B put into each field in the new table, as opposed to the actual value I want.

Here is the code I have:

ClearCollect(outputTableName; AddColumns(tableA;"SomeColumnName";tableB.C5))

 

Any tips for a powerapps rookie? 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi thanks for the information.

 

I notice that you create some custom connector to use Graph so I did a small sample here on my side.

 

At my sample I added two operations on the custom connector. The first one get all users profile, that retrieves the ID, givenName and others attributes and a second one operation that retrieve the presence of a user specified as parameter.

 

So, I used two collections. The first one to save all users and the second one to add the presence for each of the users retrieved on the first button

 

The return looks like what you sent 

 

20210318-001.jpg

 

So After that I do this at the first button and the table shows the data at the collection allUsers

 

20210318-002.jpg

 

The second button use the first collection creating a new collection and add a new column with the presence but calling another function from my custom connector for each record on the first collection

20210318-003.jpg

 

So, I think you can have to make same changes on your connector and in some way use the ID to get the presence and that way combine in one collection.

 

Please let me know if this information helped on your question.

 

Regards.

Rodrigo Hentz

Microsoft Support Engineer

View solution in original post

4 REPLIES 4
rohentz
Microsoft
Microsoft

Hi @TempUser how are you?

@TempUser maybe you have to have a common column between the two tables. That way the AddColumns will join the records adding the column on the final table. Like JOIN One Columns From Another Collection - Matthew Devaney

 

Can you give us a sample of the final data that you need if this not help?

 

Please let me know if this information helped on your question.

 

Regards.

Rodrigo Hentz

Microsoft Support Engineer

TempUser
Frequent Visitor

Hi!

Unfortunately my 2nd table only consists of 1 column (being the one I wish to add to my 1st table). 

 

This is based on a bigger case where I get a table from a custom connector using the following line of code:

UpdateContext({UserPresence:ForAll(allUsers.value.id;'Azure-GraphAPI-CustomConnector'.GetUserPresence({ids:[id]}))})

Here I send in user ID's into my custom connector which returns user presence and ID. If I was able to access these columns in my variable "UserPresence" I could match them up using the method you mentioned (match by User ID), however when I try to access the variable I only reach a table filled with tables, like this:

TempUser_0-1616014880494.png

Ideally I would want it to look like this:

TempUser_1-1616015017693.png

Using this line I was able to extract the UserPresence into a separate table, but that table only contains the one column, as seen in the original post where I'm currently stuck:

ForAll(UserPresence.value;Collect(tempTable;value.userpresence))

(UserPresence.value is the table filled with tables, and value.userpresence is the column in said table, the other being value.userid)

Hi thanks for the information.

 

I notice that you create some custom connector to use Graph so I did a small sample here on my side.

 

At my sample I added two operations on the custom connector. The first one get all users profile, that retrieves the ID, givenName and others attributes and a second one operation that retrieve the presence of a user specified as parameter.

 

So, I used two collections. The first one to save all users and the second one to add the presence for each of the users retrieved on the first button

 

The return looks like what you sent 

 

20210318-001.jpg

 

So After that I do this at the first button and the table shows the data at the collection allUsers

 

20210318-002.jpg

 

The second button use the first collection creating a new collection and add a new column with the presence but calling another function from my custom connector for each record on the first collection

20210318-003.jpg

 

So, I think you can have to make same changes on your connector and in some way use the ID to get the presence and that way combine in one collection.

 

Please let me know if this information helped on your question.

 

Regards.

Rodrigo Hentz

Microsoft Support Engineer

View solution in original post

TempUser
Frequent Visitor

Hi, thanks for the detailed response!

 

Through some more trial and error, and with the help from another thread I actually managed to solve my initial problem of making a table with presence and ID as columns (thread: https://powerusers.microsoft.com/t5/Building-Power-Apps/Collect-function-retrieves-value-as-table-or...)

However after doing so I faced some issues with joining that table with my table containing user information. Luckily this was right around the time your response came, and with some tweaking I made it work with my graph connector aswell 🙂

 

Again, thank you for the detailed response @rohentz 

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

secondImage

Power Apps Community Call

Please join us on Wednesday, October 20th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

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.

Top Solution Authors
Top Kudoed Authors
Users online (2,143)