In
the
previous demo, Peter Kalmström, CEO and Systems Designer
of kalmstrom.com Business Solutions, showed how to create a survey progress bar in the form
of a pie chart.
Here, Peter continues the powerapp survey series with a
demonstration on another kind of graphics: emoiji indicators of mood or feeling. These emojis are included in Power Apps, so Peter only needs to connect them to the survey question. As in the earlier demos he works with one of the questions/data cards.
It is not possible to insert a component in a data card, so instead, Peter creates a Moods collection with the five mood emojis and connects it to a
horizontal gallery inside the data card. As he is working with question number 3, he names the gallery galMood3.
In the gallery,
Peter inserts another, more available icon. Then he sets the Icon and Color properties of this icon to the icon values of the Moods collection.
Steps
In Power Apps Studio, App Onstart, create a collection of the different moods after the Set
formula:ClearCollect(Moods, {Number:1,Icon:EmojiSad,Color:Red});
Copy the formula exept Clear and and paste it four times in the formula bar.
Modify the pasted formulas, so that the numbers are 2-5 and the colors
and emojis are different.
Run the code at App OnStart.
Insert a blank horizontal gallery in the data card. Drag the icon inside the template.
Set the Items property for the gallery to the new collection, Moods.
Insert any icon in the gallery and adjust size and position of the icon and gallery.
Set the Icon property of the icon to ThisItem.Icon. This will give the icons from the Moods collection.
Set the icon property Color to ThisItem.Color.
Set the background fill to light grey if the icon is selected. Keep the default formula but include it in an If function: If(ThisItem.IsSelected,RGBA(211,211,211,1),RGBA(0,0,0,0))
Set the data card value field to the number that was selected in the gallery:galMood3.Selected.Number.
Hide the field.
Add the gallery to more data cards by copy and paste, and set the value field in each pasted gallery to the selected number in that gallery.
Learn more
Software that enhances SharePoint
Kanban Task Manager Visualize and co-operate on projects and tasks in SharePoint
and/or Outlook
Pivot Explorer Visualize and analyze list data in SharePoint
Templates Manager
Find, use, manage and distribute Office templates in SharePoint