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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Lookup Columns Inconsi...
Power Apps
Unanswered

Lookup Columns Inconsistently Populating in Variables

(1) ShareShare
ReportReport
Posted on by 195
I have a record of type Job that I am storing in a variable _SelectedJob. It is set my clicking on an item in a gallery of all Jobs, with Set(_SelectedJob, ThisItem).
 
Job has a lookup column Part, which in turn has multiple fields including "Part Number", "Drawing Number", etc.
 
I want to access those internal fields of the Part, which works fine upon selection from the gallery; PowerApps recognizes those fields are being used in controls with expressions like _SelectedJob.Part.'Drawing Number' and populates the respective field.
 
However, if I want to change the Part the job is running (for example with a dropdown whose items are [@Parts]), I expected to be able to do something like:
 
Set(
    _SelectedJob,
    Patch(
        [@Jobs],
        _SelectedJob,
        {Part: PartDropdown.Selected}
    )
)
 
However, while this runs perfectly fine and the field is set in the backend on the Job upon run, the variable now does NOT populate the fields of Part correctly, and they are all blank besides the GUID. Does the Patch() statement do this as an optimization? Why does it not do the same field-checking that the first Set() statement does to see which fields of _SelectedJob are accessed?
 
I am very much trying to avoid having sidecar variables like _SelectedJobPart, as the part can be changed in multiple ways.
I have the same question (0)
  • BenKraft Profile Picture
    195 on at
    To clarify, this also occurs when changing other fields of the Job:
     
    Set(
        _SelectedJob,
        Patch(
            [@Jobs],
            _SelectedJob,
            {Quantity: 10}
        )
    )
     
    This will also "wipe" the fields of _SelectedJob.Part
  • timl Profile Picture
    37,283 Super User 2026 Season 1 on at
     
    There are optimisations that are happening. 
     
    I'd check the explicit column selection settings in your app, as this may factor into what you're seeing.
     
     
    When you call Set(_SelectedJob, ThisItem). the part data may have been retrieved though the gallery or some other dependency with the gallery, therefore making it accessible via _SelectedJob.
     
    If ECS is the cause, the expanded Part data may have been dropped from the return value of Patch.
     
    You might want to try refetching the record after the Patch to see if that makes a difference. 
    Patch(
        [@Jobs],
        _SelectedJob,
        {Part: PartDropdown.Selected}
    );
    
    Set(
        _SelectedJob,
        LookUp([@Jobs], ID = _SelectedJob.ID)
    );
     
    Or if that doesn't work, you could try wrapping the call to LookUp with a call to ShowColumns, as suggested in the documentation link above.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 368 Most Valuable Professional

#2
11manish Profile Picture

11manish 150

#3
Valantis Profile Picture

Valantis 63

Last 30 days Overall leaderboard