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

Holiday Raffle App - Patch Issue

Hello,

 

I'm working on a holiday raffle app. There is a button called "Draw Winner" not shown in this screenshot that generates a random winner. In this case Brant. The flow automatically enters 'Winner' into the Status column, but does not change the 0 to a 1 in the Present column because before we run the flow to generate a random prize for Brant, we need to verify he is at the virtual party as you must be present to win. I'm trying to write a Patch statement for the OnSelect of the Gift image that will patch the SharePoint list and Refresh the winners gallery so his name appears there, but I am having trouble as the following formula is not working:

 

Select(Parent);Patch('Holiday Raffle',ThisItem,{Present:1});Refresh('Holiday Raffle')

 

PatchConceptSS.png

Here is a snapshot of the SharePoint data source. Status is a Text column. Present is a Number column. As you can see in the screenshot above, I am getting a triangle warning because my Items property number isn't wrapped in the Text function. I've tried a few variations of the Text function and can't seem to get it right so I'd be grateful for help making that adjustment as well. 

 

SortByColumns(Filter('Holiday Raffle', Present="1"), "Title",Ascending)

 

Status.PresentSS.png

Thank you in advance for your kind assistance,

Teresa

 

16 REPLIES 16
Highlighted
Super User III
Super User III

Hi Teresa,

Starting with the syntax of your Patch function, I notice that there is a red error icon next to your gift image. If you click this icon, can you post the error message that appears?

Also, can you confirm that your gift icon appears inside a gallery control with the Items property set to 'Holiday Raffle'? This would be necessary in order for you to be able to reference the selected row using the ThisItem identifier.

Highlighted

Hello,

 

@timl 

 

Thank you for taking my ticket. I don't have a gallery on top. It is a label with an image to each side. Here is the error message for the gift image.

GiftErrorMessage.png

When I saw that, I tried inserting a button control and copy pasting the formula into the OnSelect of the button and the same error message came up. Here is a screenshot of the OnSelect formula.

 

OSFormula.png

 

Does this seem like a bug to you? 

Teresa

Highlighted
Super User III
Super User III

Hi @tagustin2020 

This problem stems from the fact that there isn't a gallery. ThisItem returns the selected item from a gallery. Therefore, without a gallery, you would need some other way to reference the row that you want to update. The easiest way is to call the Lookup function and to look up the row by some unique value.

If you apply the following formula to your button, that should fix the Patch problem. This assumes that employee name is unique in your 'Holiday Raffle' list.

Patch('Holiday Raffle',
      LookUp('Holiday Raffle', EmployeeName="Brant"),
      {Present:1}
)
Highlighted

@timl 

 

Hi Tim,

 

Thank you for the explanation. In the beginning I had a gallery to display the winner. I changed over to a label because it was showing all the winners instead of just the latest one which caused an ugly scroll bar to occur. Can you advise on how to apply a filter so only the most recent winner is shown in the top gallery? We will probably raffle off between 10 and 20 items total.

 

With the other LookUp approach, Brant won’t be the only winner so can you advise on how to best set a variable in that instance? I’m very interested in learning a variety of approaches so I appreciate your help.

 

Thank you!

Teresa

 

 

Highlighted

@RandyHayes 

 

Hi Randy,

 

I'm getting nervous about my Monday deadline. Would you mind taking a look at my question? I know you work weekends too so don't worry about it if you are trying to meet a deadline of your own.

 

Thank you,

Teresa

Highlighted
Super User III
Super User III

@tagustin2020 

Sure thing.  I have a couple of things to wrap up this morning and then I will review and give you a solution.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!
Highlighted

@RandyHayes 

@timl 

 

I tried inserting a gallery and linking the label to the Employee name column. In order to get only 1 name in the gallery I tried entering the following formula with the idea being to filter the list to show the most recently selected winner as per the flow that generates a random winner, but it's not working. Can you take a look at let me know what I am doing wrong? Maybe this isn't even the right approach. Let me know if there is better way.

 

Filter('Holiday Raffle',Status="Winner" && Modified=Now())

 

Thank you,

Teresa

Highlighted

@RandyHayes 

@timl 

 

OK, I made a little progress, but something mysterious is happening. I set up a variable on my DRAW WINNER button.

 

Set(varResult,GeneralRaffle.Run().winner);

 

I inserted a gallery and in the Text property of the label I typed varResult. Only one name is showing up and there is no ugly scroll bar. The Patch formula for the gift image which is inside the gallery also works so I thought I was good to go, but now there is a different issue.

 

InvisibleGalleryShowSS.png

When I click play the Gallery disappears! Any idea what is causing this?

 

InvisibleGalleryHideSS.png

Teresa

Highlighted
Super User III
Super User III

@tagustin2020 

So as I read this, these are my assumptions:

1) You have a PowerAutomate flow that is randomly picking winners from some undetermined list.  When it randomly picks one, it creates a record in the Holliday Raffle list.  Marking the Status as "Winner" (is this a Choice or text column?) and Present as "0" (is this a yes/no, text, numeric or choice column?)

 

2) You have a PowerApp that needs to show the most recently chosen winner.  A human will press some sort of button/object to mark if the person is present or not. 

 

I hope so far I am on track. 

 

My questions based on the assumptions above:

1) What happens is no one marks the person as present or not before another flow is run?  And, is the flow on a timer or triggered by some other method?

2) If (based on #1 above) someone does not mark a person as present before the next winner is drawn, is the original winner still eligible and also the new one, or is it just the last person the flow picks?

 

Some answers to the above will help with a solution and appropriate approach to this. 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

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,680)