Skip to main content

Notifications

Community site session details

Community site session details

Session Id : sV15iWVsEifn/172+2S1PX
Power Apps - Building Power Apps
Answered

AddColumn with Lookup for each Record in Collection

Like (0) ShareShare
ReportReport
Posted on 28 Apr 2020 12:47:45 by

Hi,

 

I have a collection that I want to add a column to. For each record I need to return the Question by looking up the idQuestion from the collection to a different table. The problem is that the collection results in repeating the first result (Question) through each record.

 

For example:

Here is what I'm getting in my collection:

idQuestionQuestion
1Question 1
2Question 1
3Question 1
4Question 1

 

This is what I want:

idQuestionQuestion
1Question 1
2Question 2
3Question 3
4Question 4

 

Here is my code:

 

ClearCollect(
 colSurvey,
 AddColumns(
 '[dbo].[Surveys]',
 "Question",
 LookUp('[dbo].[SurveyQuestions]',idQuestion = idQuestion,Question)
 )
)

 

Thank you

Categories:
  • Community Power Platform Member Profile Picture
    on 28 Apr 2020 at 12:56:05
    Re: AddColumn with Lookup for each Record in Collection

    @mdevaney Perfect! Silly oversight on my part.

     

    Thank you!

  • Verified answer
    mdevaney Profile Picture
    29,987 Super User 2025 Season 1 on 28 Apr 2020 at 12:52:58
    Re: AddColumn with Lookup for each Record in Collection

    @justair007 
    The issue is with this section of code

    idQuestion = idQuestion

     

    You'll need to specify which table the idQuestion comes from using the disambiguation operator [@] as I have done below.

    ClearCollect(
     colSurvey,
     AddColumns(
     '[dbo].[Surveys]',
     "Question",
     LookUp('[dbo].[SurveyQuestions]',idQuestion = '[dbo].[Surveys]'[@idQuestion],Question)
     )


    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Apps - Building Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 89 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 60

#3
stampcoin Profile Picture

stampcoin 48

Overall leaderboard
Loading started