cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
GuyBoswell
Advocate II
Advocate II

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
WarrenBelz
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
WarrenBelz
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

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

Ah ha!  Fixed it

 

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

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
   }
)

 

  

Thanks @Drrickryp ,

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

smile.gif

 

GuyBoswell
Advocate II
Advocate II

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
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (3,292)