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

 

17 REPLIES 17
Super User III
Super User III

@tagustin2020 

Looks like we cross posted...

I see no particular reason for a Gallery in any of this.  So, let me know on the last-post questions

I do see now how you are kicking off your flow though now.

_____________________________________________________________________________________
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!

@RandyHayes @timl 

 

I forgot to mention that I set the Items property of the gallery to:

 

Filter('Holiday Raffle',Status=varResult)

 

Do I need to write that formula a different way? When the app isn't in play, there is a name in there.

InvisibleGalleryShowSS.png

I tried reordering the gallery in case something else was covering it up, but moving it to the front of the app isn't helping. Visibility is On so I'm really at a loss for why it won't show up when played. Teresa

@RandyHayes 

 

Thanks Randy!

Super User III
Super User III

@tagustin2020 

Okay. Not sure what all the variables are or are for - generally not needed.

Let know if you are good on it then and if you need anything else.

 

_____________________________________________________________________________________
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!

@tagustin2020  No idea if you've solved your problem. Just to point out, your gallery isn't disappearing. It's probably just not showing any records because none match the filter you've set (Status = varResult).

 

I realize this probably doesn't solve your whole problem, I don't have a good enough picture of what it is precisely that you're trying to do and how it's all connected, but I just thought I'd point this out so that you don't waste time looking at the wrong things for possible causes.

@RandyHayes 

 

Hi Randy,

 

Thanks for taking a look at this. I'll be the only one pressing a button on this app so we shouldn't have conflict issues.

 

Here is a summary of the lists, flow, app:

 

I have 2 SharePoint lists. A parent list called 'Holiday Raffle' which lists all employees and a child list called 'Holiday Raffle Prizes'. I have 2 flows that work on select of a button. The first "DRAW WINNER" button runs a flow that randomly selects a winner and fills in the word "Winner" in the Status column. Employees must be present to win so the Patch statement in the OnSelect of the gift image - Select(Parent);Patch('Holiday Raffle',ThisItem,{Present:1});Refresh('Holiday Raffle') -  updates the Present column to "1" which results in their name showing up in the official Winners list which is filtered according to this criteria.  The lump of coal OnSelect Patch statement - Select(Parent);Patch('Holiday Raffle',ThisItem,{Present:0,Status:""});Refresh('Holiday Raffle') - for now returns their status to zero which isn't good as they can potentially be picked again by the random picker so I'm working on a separate flow that will be tied to the lump of coal to move them to an absentee list and delete them from the Holiday Raffle list. The second "DRAW PRIZE" button runs a flow that randomly picks a prize. I want the "Official Winner" gallery to update the sub-title field with that prize, but I'm not sure how to marry the two lists. As you can see, I've created Prize ID and Prize column placeholders in my Master list. I've been asking for help from the Flow Community on how to add that piece to my prize picker flow, but haven't heard anything back yet. I've been searching forums and watching videos with no luck finding what I need so if you know the answer, I'd love to hear it.

 

Here are snapshots of the Holiday Raffle parent list:

HolidayRaffleSettings.png

HolidayRafflePostPatch.png

Here are snapshots of the Holiday Party Prizes list:

RafflePrizeSettings.png

RafflePrizeListSS.png

I know this thread is getting long, so let me mention two things I'm trying to work out from early posts in this thread. 1) I have the app working so the name populates in the gallery label, but the gallery is only visible in edit mode. When I play the app, the gallery disappears. I have already verified that there are no other objects obstructing the view of the gallery 2) Because I am using number fields to indicate whether or not someone is present, I'm getting a yellow triangle in my Filter formula. I know it wants me to wrap it in the Text function somewhere, but I can't find a combination that works. Here is my Items property filter formula: SortByColumns(Filter('Holiday Raffle', Present="1"), "Title",Ascending)

 

Let me know if any of this isn't clear or if you need more info.

 

Kind regards,

Teresa

@OliverR-82 

 

Hi Oliver,

 

Thanks for the response. I can see a result when the app is in Edit mode, just not when it is in play. I've never seen this happen before so it's odd.

 

Teresa

Post Prodigy
Post Prodigy

Sorry for the delay in closing out this ticket. Randy helped me out with the following OnSelect formula for the gift image:

 

UpdateContext({lclPrize:First(Shuffle(Filter('Holiday Party Prizes', Party.Value = ddPartyChoice.Selected.Value && !(Status="Awarded"))))});
UpdateIf('Holiday Raffle',ID=lclWinner.ID,{Status:"Awarded",Prize:lclPrize.Title});
UpdateIf('Holiday Party Prizes',ID=lclPrize.ID,{Status:"Awarded"});
UpdateContext({lclWinner:Blank()})

 

Thank you Randy!

@RandyHayes 

@OliverR-82 

View solution in original post

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (69,502)