cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Resident Rockstar
Resident Rockstar

Simple Patch() not working in gallery in collection.

Is there something fundamentally wrong with using patch in a gallery in a collection.  I know its right.  Its far too simple.

 

As shown below.  You pick the mail icon, and false should change to true.  nothing happens, no errors.

 

Column three is Thisitem.EmailFlagged.  Initial values are false, it should flip to true.

 

image.png

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Ok, I figured it out.   I thought I had a pre-posted value of "false" in all my records.  Turned out they didn't all get it.  Blank showed as false but didnt toggle.  I got all the data posted with false now in my addcolumns() command.  I'm good now.  

 

They date refreshes immediately too, as it should.  Even the counter I made.  Its perfect now.  Thanks everyone!  Kudos deployed...

View solution in original post

8 REPLIES 8
Highlighted
Dual Super User II
Dual Super User II

@martinav 

 

Is MDL_ALL the name of your collection?

Is the gallery Items property based on the same collection?

 

 

Highlighted
Dual Super User III
Dual Super User III

I would think you need to do a Lookup() using a unique property of thisitem, something like this.

patch(mdi_All, Lookup(mdi_All, ID = thisitem.Id),{EmailFlagged:true})

ThisItem alone identifies the item in the gallery, but not in the data source and that's what you need to patch. 



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Highlighted

If the gallery is based on the same collection then Thisitem should suffice

 

Highlighted

@Pstork1 ,

 

I tried that too.  No go.  Same result.

 

@RezaDorrani ,

 

Yes, that is what I thought.  I have used this before.  Its nothing new to me.  Its just pure not working.  Some nuance somewhere I'm missing.  

 

I still need some resolution here.  Knowing its right, I have nowhere else to look that is rational.

Highlighted

I know this is working.  I put a context variable in it and a free floating label, and its updating.  

 

 

 

Patch(MDL_All,LookUp(MDL_All,ID=ThisItem.ID),{EmailFlagged:true}); 
UpdateContext({TestFlip:!TestFlip})

 

 

There are still no errors, no red lines, no nothing.

 

My label flips between true/false.  But, my gallery is still unaffected. 

Highlighted

@martinav 

 

is the collection updating?

did you check the collection under view- collections to see if the updates are being pushed through?

 

Can you also share screenshot of items property of gallery

Highlighted
Dual Super User III
Dual Super User III

Do you perhaps need to throw either a Refresh() or Reset() in there somewhere to pick up the change submitted via patch?



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Highlighted

Ok, I figured it out.   I thought I had a pre-posted value of "false" in all my records.  Turned out they didn't all get it.  Blank showed as false but didnt toggle.  I got all the data posted with false now in my addcolumns() command.  I'm good now.  

 

They date refreshes immediately too, as it should.  Even the counter I made.  Its perfect now.  Thanks everyone!  Kudos deployed...

View solution in original post

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (7,454)