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 for Dataverse t...
Power Apps
Answered

LookUp for Dataverse table

(0) ShareShare
ReportReport
Posted on by 57

I have a dataverse table called Project_Agenda. In powerapp I have a collection called colAgendaDatabase. The collection is composed of all columns belonging to Project_Agenda table and some more. In the powerapp I change some values of the collection.

 

I want to update Project_Agenda table based on collection colAgendaDatabase but it does not work with the below code:

ForAll(
 colAgendaDatabase,
 Patch(
 Project_Agenda,
 LookUp(Project_Agenda, Project_Agenda = Project_Agenda ),
 {
 'CW20/23':txtCW2023.Value
 }
 )
);

 Project_Agenda is the unique identifier (display name) in Dataverse table.

cr02d_project_agendaid is the unique identifier in both Dataverse table and collection. The unique identifiers are of course the same for corresponding records in table and collection. 


I tried also other code variation (difference in lookup function) but it also does not work:

ForAll(
 colAgendaDatabase,
 Patch(
 Project_Agenda,
 LookUp(Project_Agenda, Project_Agenda = colAgendaDatabase[@cr02d_project_agendaid]),
 {
 'CW20/23':txtCW2023.Value
 }
 )
);

 

Categories:
I have the same question (0)
  • Rajkumar_M Profile Picture
    3,747 Moderator on at

    Hi

    Try this

    ForAll(
    colAgendaDatabase,
    Patch(
    Project_Agenda,
    LookUp(Project_Agenda, Project_Agenda = ThisItem.Project_Agenda),
    {
    'CW20/23': txtCW2023.Value
    }
    )
    )

    (Or)

    ForAll( colAgendaDatabase,

    Patch( Project_Agenda,

    LookUp(Project_Agenda, cr02d_project_agendaid = ThisRecord.cr02d_project_agendaid),

    { 'CW20/23': txtCW2023.Value } ) )

    Thanks!

    If my response has been helpful in resolving your issue, I kindly request that you consider clicking "Accept as solution" and "giving it a thumbs up" as a token of appreciation.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @Rajkumar_404  ThisItem only works if he is using a gallery.

    Use UpdateIf instead of patch

    UpdateIf ( [DataSource], [Condition], { [Items] } ) 
    Regards.

  • Lonsdejlit Profile Picture
    57 on at

    @Rajkumar_404 
    It does NOT work. When I isolate the Patch function (remove ForAll), then I see two errors for:

    1. "ThisItem.Project_Agenda" --> "Name isn't vaild. 'ThisItem' isn't recognised

    2. "=" --> "Incompatible types for comparison. These types cant be compared: Guid, Error."

  • Rajkumar_M Profile Picture
    3,747 Moderator on at

    As advised by @OussamaOsman , consider utilizing the UpdateIf function.

    UpdateIf(

    Project_Agenda,

    cr02d_project_agendaid = colAgendaDatabase[@cr02d_project_agendaid],

    { 'CW20/23': txtCW2023.Value // Add other columns to update in the UpdateIf function if needed

    } )

    Thanks!

  • Talha_Dar Profile Picture
    870 Super User 2024 Season 1 on at

    Hi @Lonsdejlit,

     

    use the following formula to update your datasource.

     

    ForAll(
     colAgendaDatabase As currRecord,
     Patch(
     Project_Agenda,
     LookUp(Project_Agenda, Project_Agenda = currRecord.Project_Agenda ),
     {
     'CW20/23':txtCW2023.Value
     }
     )
    );

     

    If you found my answer helpful, please consider giving it a thumbs-up or a like. Your feedback is greatly appreciated!

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • Lonsdejlit Profile Picture
    57 on at

    @Talha_Dar 

    Your solution works- with one issue. Once I update in the collection the value of 

    txtCW2023.Value

    for one record then the update is assigned to all records of the column 

    'CW20/23'

     

    @OussamaOsman 

    I utilize indeed the gallery but your proposal still does not work.

     

    @Rajkumar_404 

    Thank your for correction but it still does not work. BTW you forgot probably ForAll function or?

  • Rajkumar_M Profile Picture
    3,747 Moderator on at

    As you are right I forgot ForAll function 

    ForAll( colAgendaDatabase,

    UpdateIf(

    Project_Agenda, cr02d_project_agendaid = colAgendaDatabase[@cr02d_project_agendaid],

    { 'CW20/23': txtCW2023.Value 

    ) )

    Thanks!

  • Lonsdejlit Profile Picture
    57 on at

    @Rajkumar_404 

    I am very sorry but the solution does not work neither:

    ForAll( 
     colAgendaDatabase,
     UpdateIf(
     Project_Agenda, 
     cr02d_project_agendaid = colAgendaDatabase[@cr02d_project_agendaid],
     {
     'CW20/23': txtCW2023.Value
     }
     ) 
    )

    BTW. this time you forgot to close the brase "}", but it does not change the result...

  • Rajkumar_M Profile Picture
    3,747 Moderator on at

    Just Update @Talha_Dar suggested formula 

    Try this

    ForAll( colAgendaDatabase As currRecord,

    UpdateIf( Project_Agenda, cr02d_project_agendaid = currRecord.cr02d_project_agendaid,

    { 'CW20/23': currRecord.txtCW2023.Value } )

    );

    Thanks!

  • Verified answer
    Talha_Dar Profile Picture
    870 Super User 2024 Season 1 on at

    Hi @Lonsdejlit,

     

    If you don't want to update the 'CW20/23' of all the items, then you should not use the 'ForAll' function. Instead, you can use the following formula to update a single item based on your gallery selection.

     

    Patch(
     Project_Agenda,
     LookUp(Project_Agenda, Project_Agenda = Gallery6.Selected.Project_Agenda ),
     {
     'CW20/23':txtCW2023.Value
     }
    )

     

    If you found my answer helpful, please consider giving it a thumbs-up or a like. Your feedback is greatly appreciated!

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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 July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 377 Most Valuable Professional

#2
11manish Profile Picture

11manish 165 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 110 Super User 2026 Season 2

Last 30 days Overall leaderboard