web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Collection: Can you ad...
Power Apps
Unanswered

Collection: Can you add a column which is a lookup for the source table?

(0) ShareShare
ReportReport
Posted on by 85

I am using a collection to create new records.  In the new record I hvae a look up which she be set to the record used to create the collection in the first place. My idea was something like this:

 

ClearCollect(
collTemp,
AddColumns(
'SourceTable',
"lookup",<sourcetable>
)
);

 

ForAll(
collTemp,
Patch(
TargetTable,
Defaults('TargetTable'),
{
:

'Source Table':collTemp[@lookup]

:
}
)
);

 

Is there any way this might work? or maybe there is a better way to do it?

 

Thanks in advance

Mark

 

Categories:
I have the same question (0)
  • deg85 Profile Picture
    85 on at

    managed to implement it by using a lookup to the source table.  would still be interested to know if there is a better, more efficient way:

     

    ClearCollect(
    collTemp,
    AddColumns(
    'SourceTable',
    "Source GUID",sourcetableid
    )
    );

     

    ForAll(
    collTemp,
    Patch(
    TargetTable,
    Defaults('TargetTable'),
    {
    :

    'Source Table':LookUp(SourceTable, sourcetableid=collTemp[@'Source GUID']

    :
    }
    )
    );

     

  • WarrenBelz Profile Picture
    153,032 Most Valuable Professional on at

    Hi @deg85 ,

    I am assuming you are patching a single field with the entire record from Source Table into one field 'Source Table'?

    With(
     {
     wGUID:
     AddColumns(
     SourceTable,
     "SourceGUID",
     sourcetableid
     )
     },
     ForAll(
     wGUID As aPatch,
     Patch(
     TargetTable,
     Defaults(TargetTable),
     {
     'Source Table':
     LookUp(
     SourceTable, 
     sourcetableid=aPatch.SourceGUID
     )
     }
     )
     )
    )

     

    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

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard