cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jja
Post Prodigy
Post Prodigy

patching lookup column assigns to wrong record

Hi

I have a patch statement where it creates new records in my dataverse table. The problem is if my Components table field Komponento pavadinimas contains duplicate values(same Component name for different projects) So if i patch component name lets say 001 and asign it to project Project2 with patch it will assign this 001 to Project1 if Project1 has this component with same name. My questions is how to correctly use patch and assign this component with duplicate name(thow it is a separate record) to correct project?

Maybe @RandyHayes you have a solution for that?

 

 

Patch(Transactions,

ForAll(

    Filter(Gallery1.AllItems,Checkbox1.Checked) As gTable ,

    {

        new_qty:Value(gTable.TextBox1.Value),

        new_transactiondate:DateOperacijosData.Value,

        new_Employeecode:LookUp(Employees,'Darbuotojo kodas'=FilterDarbuotojasCard.Selected.'Darbuotojo kodas'),

        new_Projectname:LookUp(Projects,'Projekto pavadinimas'=FilterProjektoNuorodaCard.Selected.'Projekto pavadinimas'),

        new_Stagename:LookUp(Stages,'Darbo pavadinimas'=FilterDarboTipasCard.Selected.'Darbo pavadinimas'),

        new_Componentname:LookUp(Components,'Komponento pavadinimas'=gTable.'Komponento pavadinimas')

    }

   )

);

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @rampprakash 

I actually found the correct way how to do that in case when patching a lookup field that has multiple same Name values in dataverse

Dataverse allows to patch lookup field by it's unique identifier so what i did is:

new_Componentname:LookUp(Components,Components=gTable.Components)

 

And it did the trick. Now it creates records and assigns accordingly

 

View solution in original post

2 REPLIES 2
rampprakash
Super User
Super User

Hello @jja 

 

Hope you are doing good,

 

Can you please make sure below query returning only one values

 

LookUp(Employees,'Darbuotojo kodas'=FilterDarbuotojasCard.Selected.'Darbuotojo kodas')

 

 

Hi @rampprakash 

I actually found the correct way how to do that in case when patching a lookup field that has multiple same Name values in dataverse

Dataverse allows to patch lookup field by it's unique identifier so what i did is:

new_Componentname:LookUp(Components,Components=gTable.Components)

 

And it did the trick. Now it creates records and assigns accordingly

 

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!

Users online (5,725)