cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Shalom47
Helper I
Helper I

Add column to collection from SQL data source

Hi,

 

I have a collection called ColData as below:

CompanyName
Apple
Sony
Google

 

I have a sql table CompanyData as below:

IdCompanyNameCompanyLocation
1AppleCalifornia
2SonyTokyo
3GoogleSan Fransico
4SamsungSeol

 

I want to add "Id" column from SQL table to my collection ColData so that my ColData will look like below:

IdCompanyName
1Apple
2Sony
3Google

 

I have tried AddColumns(ColData,"Id",Filter(CompanyData,CompanyName=ColData.CompanyName)); but it is not working Could anyone pls help

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz
Super User
Super User

Hi @Shalom47 ,

Having the two columns the same name does not help, but try this

AddColumns(
   ColData As aCol,
   "Id",
   LookUp(
      CompanyData,
      CompanyName = aCol.CompanyName
   ).Id
)

 

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.

Visit my blog Practical Power Apps

View solution in original post

1 REPLY 1
WarrenBelz
Super User
Super User

Hi @Shalom47 ,

Having the two columns the same name does not help, but try this

AddColumns(
   ColData As aCol,
   "Id",
   LookUp(
      CompanyData,
      CompanyName = aCol.CompanyName
   ).Id
)

 

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.

Visit my blog Practical Power Apps

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (5,531)