cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper III
Helper III

Hide, don't delete

Dear All,
I have a problem, half an idea of a solution but really need some help with the details.

Background
I work for a charity that raises money by recruiting partners at events, i.e. they sign up to give so much a month.

I have two SharePoint lists
TableEvents holds date, location, topic, speaker etc, plus total number of partners and total monthly amount pledged. It has a unique value colEventCode
TableEventPartners has four columns:
colEventCode - to link to TableEvents
colAmount - a monthly amount that one or more partners have pledged
colNumber - the number of partners who have pledged at that rate
colTotal - a calculated column = colAmount * colNumber

I have built app based on TableEventPartners. For the purposes of working out this problem I have gone back to a standard, wizard built app with BrowseScreen1, DetailScreen1 and EditScreen1 and no changes except as below.

I have a Power Automate flow, triggered by amendment or change to TableEventPartners that calculates the overall total number and amount of partnerships and updates the appropriate record in TableEvents. Changes to TableEvents in turn trigger another flow to send an email report of the event to various people.

So far so good...

Problem! A user can delete a partner record from TableEventPartners by clicking on DetailScreen1.IconDelete1
Because the record has been deleted the flow doesn't have a value for colEventCode to know which record to update on TableEvents.

Proposed solution! I want the user to click on the delete icon and the record to appear to be deleted but actually be hidden. I have changed BrowseGallery1.Items to include &&Value(colTotal)<>0 so it doesn't display records where colAmount or colNumber = 0. (Don't worry about the delegation error that introduces - I know how to solve that). I can write a housekeeping flow to routinely delete any record on TableEventPartners where colTotal = 0

Where you can help? What do I put in DetailScreen1.IconDelete1.OnSelect to set colAmount = 0 and colNumber = 0 and navigate back to BrowseScreen1?

Thank you very much for all your wonderful help,
Guy

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User III
Super User III

Hi @GuyBoswell ,

A Patch would do it

Patch(
   TableEventPartners,
   {ID:YourGalleryName.Selected.ID},
   {
      colAmount:0,
      colNumber:0
   }
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

7 REPLIES 7
Highlighted
Super User III
Super User III

Hi @GuyBoswell ,

A Patch would do it

Patch(
   TableEventPartners,
   {ID:YourGalleryName.Selected.ID},
   {
      colAmount:0,
      colNumber:0
   }
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

Highlighted

Hi @WarrenBelz ,

Thank you very much for your help.  I copied and pasted exactly as in your text except replacing 

{ID:YourGalleryName.Selected.ID} with {ID:BrowseGallery1.Selected.ID}, BrowseGallery1 being the name assigned automatically when I created the app.

I get an error,

"Expected operator.  We expect an operator such as +, *, or & at this point in the formula"

Any idea which operator and where it needs to go?

Thank you again for your help.

Guy

Highlighted

Ah ha!  Fixed it

 

Patch(
TableEventPartners,
{ID:BrowseGallery1.Selected.ID},
{
colAmount:0
},{
colNumber:0
}
)

Highlighted

Hi @GuyBoswell 

@WarrenBelz 's would have worked too.  He left out a comma between the colAmount and colNumber

 

Patch(
   TableEventPartners,
   {ID:BrowseGallery1.Selected.ID},
   {
      colAmount:0,
      colNumber:0
   }
)

 

  

Highlighted

Thanks @Drrickryp ,

Fixed it so as to not confuse people in the future - dangers of free-typing instead of in my test app.

Highlighted

smile.gif

 

Highlighted
Helper III
Helper III

Thank you guys, you are wonderful.

Please may I ask a supplementary question? I like to understand why a solution works, not use it blindly.

Why the curly brackets {}? What do they signify?

Why do both {colAmount:0,colNumber:0} or {colAmount:0},{colNumber:0} work?

 Thank you,

Guy

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

Top Solution Authors
Top Kudoed Authors
Users online (11,667)