cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SectorOMEGA
Helper IV
Helper IV

Creating something like guessing game

Im looking for a little advise and some kick in order to create something like guessing game in powerapps. The idea is that an employee will register and upload a picture of his pet(for example). After the registration period ends I want to make several screens that will contain the pictures of the pets and the user should guess whos pet this is. Is this possible to be created? The part that Im most lost is the correct and wrong answer. Appreciate the help. Thank you.

1 ACCEPTED SOLUTION

Accepted Solutions
SqtaMorda
Resolver II
Resolver II

To receive results you can add Input/Toggle control to your gallery and give it default value:

If(ThisItem.EmployeeName = ComboBox2.Selected.Value, true, false)

 For now you can leave it visible, but later on change Visible to false.

 

Add some Button and and name it btnSaveQuiz, with onSelect property:

 

this will be resulted as number - 0.5 for eg.

Set(varQuizResult, CountIf(Gallery.AllItems, Toggle1.Value = true) / CountRows(Gallery20.AllItems)))

 

this will format it to 50.0%:
Set(varQuizResult, Text(CountIf(Gallery.AllItems, Toggle1.Value = true) / CountRows(Gallery20.AllItems)*100, "#.0%"))

then you need to save it by Patching
Patch(yourDataBase, {colName: User().Email/FullName, colResult: varQuizResult})

 

View solution in original post

11 REPLIES 11
SqtaMorda
Resolver II
Resolver II

Hi SectorOMEGA!


I would do Sharepoint list where columns are employee data. In PowerApps i would do Form to add data to this List. User (employee) adds his/her data (name, pet name for eg) and pet image as attachment.
Then after like you said registration period ends, i would show users gallery where i show collection from your list.

Using Shuffle(yourCollection/SharepointList) you can achive random view of items in gallery.

Using FirstN you can get limited number items to guess.


About "The part that Im most lost is the correct and wrong answer."
In gallery you can show image of pet and blank ComboBox, user can pick person (name) there.
when ThisItem.Name = ComboBox.Selected.Value is true then user picked correct person. 



Thats nifty idea 🙂 Thank you so much. The thing Im not familiar with is the gallery style and how to achieve it 😄 Struglling how to show the attached image in the gallery

SqtaMorda
Resolver II
Resolver II

@SectorOMEGA 
Remember to change MaxAttachment of your attachment DataCardValue to 1 and change MaxAttachmentSize too. Make attachment DataCard required.
This will force user to upload only one attachment and will protect interface from long pet loading image (large size).
In gallery add Media/Image.
Make it big enough and in Image property place: 
First(ThisItem.'{Attachments}').Value

Having a little issue. I have added blank gallery, set up the images, added comboBox with the source of my sharepoint column EmployeeName. All good till now, however when I add a label below the combobox, I have tried to input its Text Properties it like this:

 

ThisItem.Name = ComboBox2.Selected.Value

 

 However Im geting an error: Identifier not recognized. I have tried it like this also:

 

If(ThisItem.EmployeeName = ComboBox2.Selected.Value, "Correct answer", "Wrong answer")

 

but again getting error that those cannot be compared

SqtaMorda
Resolver II
Resolver II

If(ThisItem.EmployeeName = ComboBox2.Selected.Value, "Correct answer", "Wrong answer")

 

But remember, you have to figure out how your game will work when user select person from ComboBox.
When he will see answer instantly he will be able to change wrong picks until he find correct one.

Ahhhh you soo right again. Now to go figure out how to make it as a quiz and receive the results once all questions are guessed 😞

SqtaMorda
Resolver II
Resolver II

To receive results you can add Input/Toggle control to your gallery and give it default value:

If(ThisItem.EmployeeName = ComboBox2.Selected.Value, true, false)

 For now you can leave it visible, but later on change Visible to false.

 

Add some Button and and name it btnSaveQuiz, with onSelect property:

 

this will be resulted as number - 0.5 for eg.

Set(varQuizResult, CountIf(Gallery.AllItems, Toggle1.Value = true) / CountRows(Gallery20.AllItems)))

 

this will format it to 50.0%:
Set(varQuizResult, Text(CountIf(Gallery.AllItems, Toggle1.Value = true) / CountRows(Gallery20.AllItems)*100, "#.0%"))

then you need to save it by Patching
Patch(yourDataBase, {colName: User().Email/FullName, colResult: varQuizResult})

 

View solution in original post

Hats down for this!!! ut there is still something wrong with my code.

In the Gallery, for ComboBox.Items I have:

'SPlist'.EmployeeName

In order to grab all the names that will be registered.

For the toggle as you have purposed Im using your code and getting an error: Incompatible types for comparison at '=' sign

SqtaMorda
Resolver II
Resolver II

in this case change each

ComboBox2.Selected.Value

to

ComboBox2.Selected.EmployeeName

 

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

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.

Top Solution Authors
Top Kudoed Authors
Users online (956)