Skip to main content
Community site session details

Community site session details

Session Id :

Contest Registration (Microsoft sample)

mblythe Profile Picture Posted by mblythe

contest-registration.png

 

Description

This visually appealing tablet app enables customers or employees to sign up for a contest. The app captures contact information and favorite activities.

 

Data connections

Common Data Service (Contacts entity). For more information about this data source, see The Common Data Service.

 

Setup and usage info

To run and explore this app, open the Contest Registration template from web.powerapps.com. For more information, see Create and run an app from a template.

 

Author's helpful tips and formula lessons

> The first screen (HomeScreen) looks like one well-designed graphic, but it's actually composed of an image in the top half, with a rectangle, a text label, and a button in the bottom half. Take a look at how nicely the text is rendered and how well the design elements come together.

 

> The second screen (RegistrationScreen) looks very custom, but the core of the screen is an edit form, with the text matching the rest of the design. An image provides a dramatic background while a rectangle with transparency set keeps attention on the form.

 

> The information collected on the RegistrationScreen is written to the Contacts entity in the Common Data Service. The information on the FavoriteActivitiesScreen is stored locally in a collection, but in a production app, you would typically write this data back to a custom entity.

 

Let's look at the formula used to write to the collection:

 

If((button1||button2||button3||button4||button5||button6||button7||button8||button9||button10)=true,ClearCollect(favorites,{favoriteactivities:If(button1=true,Button1_3.Text&", ")&If(button2=true,Button1_4.Text&", ")&If(button3=true,Button1_5.Text&", ")&If(button4=true,Button1_6.Text&", ")&If(button5=true,Button1_7.Text&", ")&If(button6=true,Button1_8.Text&", ")&If(button7=true,Button1_9.Text&", ")&If(button8=true,Button1_10.Text&", ")&If(button9=true,Button1_11.Text&", ")&If(button10=true,Button1_12.Text)});Navigate(ThanksScreen, Fade),UpdateContext({finish_error:true}))

 

That looks pretty complex, but here's the gist of what the formula is doing:

  • If at least one button is clicked, write the value of each clicked button to the collection "favorites".
  • If no buttons are clicked, set the context variable "finish_error" to true, so that an error message is displayed.

 

Other Relevant Blogs and Online Resources

Understand variables in PowerApps (collections and context variables)

Categories:

Comments