Power Apps Workout 04 - Variables and Buttons

In this workout, we will use Variables and Buttons within Power Apps to our advantage.

The objective is to create a sample Canvas app where there are 3 Controls (1 Text Input, Text Label and 1 Button) in the arrangement specified below. A user can write a word into the Text Input, select the “Add Word” button, and it adds the users word to the Label string below. The user can add as many words as they want. Here is an example:

In this Workout, we need use both Variables and Fx formulas (such as Concatenate). Please submit your solution in the by taking a screenshot of your Power App, showing the “formula” you used to on the OnSelect action of the Button Control.

Enjoy! Let me know if you have any questions.

Henry

@henry.habib ,

Nice workout. Thanks

Solution

@henry.habib - another good workout.

My solution

Add the following function to the OnSelect in the Button:

"Set(varWorkout004, Concatenate(varWorkout004, ", “, TextInput1_1) )”

And then the label uses the “varWorkout004” variable for it’s text.

Workout 004 Pic

Nice work all. Looks great. One day I’ll jump into one of these myself. I want to up my Power Apps game

Here is the answer to the Workout. The key here is to use a recursive Variable format. After you create all the necessary Controls, then:


  1. Select the Button Control
  2. Select the OnSelect Property
  3. Change the “fx” to the following: Set(VarString, Concatenate(VarString, ", ", TextInput1.Text))
  4. Select the Label Control
  5. Make the Text Property equal to the Variable you created in Step 3

Best,
Henry