cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Resident Rockstar
Resident Rockstar

Re: Simple Patch() not working in gallery in collection.

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
Dual Super User

Re: Simple Patch() not working in gallery in collection.

@martinav 

 

Is MDL_ALL the name of your collection?

Is the gallery Items property based on the same collection?

 

 

Highlighted
Dual Super User II
Dual Super User II

Re: Simple Patch() not working in gallery in collection.

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
Dual Super User
Dual Super User

Re: Simple Patch() not working in gallery in collection.

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

 

Highlighted
Resident Rockstar
Resident Rockstar

Re: Simple Patch() not working in gallery in collection.

@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
Resident Rockstar
Resident Rockstar

Re: Simple Patch() not working in gallery in collection.

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
Dual Super User
Dual Super User

Re: Simple Patch() not working in gallery in collection.

@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 II
Dual Super User II

Re: Simple Patch() not working in gallery in collection.

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
Resident Rockstar
Resident Rockstar

Re: Simple Patch() not working in gallery in collection.

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
Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

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