Learn with

Voxtus

Variables (Set, Context, Collection)

In Power Apps, variables and functions are fundamental concepts used to create dynamic and interactive apps. Here's a definition of variables and functions in Power Apps:

Variables:

  • Definition: Variables in Power Apps are used to store and manage data temporarily within your app. They can hold different types of data, including text, numbers, Boolean values, and more.
                          Syntax: Local variable-Set(LocalVariableName, Value);
                                  EX-Set(LocalVar, "Hello, Power Apps!")
                                  Global Variable-Set(GlobalVariableName, Value);
                                  EX-Set(GlobalVar, "This is a global variable")
  • Purpose: Variables are often used for various purposes such as storing user input, creating calculations, managing app state, or storing intermediate values.
  • Scope: Power Apps supports two main types of variables:
  • Local Variables: These are limited in scope to a specific screen or context within the app. They are cleared when you navigate away from the screen.
  • Context Variables: These have a broader scope and persist across screens within the app. They can be used to store and share data at the app or session level.

So here is the example from app.

To implement this functionality, you can follow these steps:

  • Select the text input within the first name data card and update its OnChange property to: "Set(VarFirstName, DataCardValue6.Text)".
Variables
  • Then, choose the text input inside the last name data card and modify its OnChange property to: "Set(VarLastName, DataCardValue7.Text)".
Variables
  • Lastly, select the full name data card and adjust its Default property to: "Concatenate(VarFirstName, " ", VarLastName)".
Variables

An example of “Collection” is collecting data from the gallery is to utilize the "Collect(ColStudentData, Gallery2.AllItems)" function within the "OnVisible" property of the detail screen.

Variables