What is PowerApps
- PowerApps is the platform/service provided by Microsoft.
- We can use PowerApps to build business apps by using low code, no code technology that runs on browsers, mobile, or tablets.
Usage
- If we are working with one or more database, then PowerApps quickly integrate more than one database to one place
- To build quick application that will be used for specific purpose
What are the different types of PowerApps
- Canvas App
- Model Driven App
- Portal Apps
Canvas App
- In canvas app we can drag and drop controls to the screens and create meaningful design by placing various controls at proper place on the screen
- When your design part completes you can add different database to the application and assign the controls to the database fields
- We can connect more than 200 data sources to the application
- You can go with canvas app if your application is Design oriented
- Canvas App takes design first approach
- Canvas app is not responsive by default, we must use containers and different controls to make it responsive
Model Driven App
- Model driven app takes data first approach
- You can use model driven app where there is complex business logic like tables are internally connected to each other
- We can use CDS(Common Data Source)/Dataverse as a database
- This application is responsive by default
- Ex-Library Application
Portal App
- Portal App allows user to create website and share it with organization and outside
- It allows customizing pages
Variables in PowerApps
We can use variable to hold the data temporarily
Local Variable
- Scope of variable – within the screen
- Syntax – UpdateContext ({ varlocal : ”demovariable”)
Example
1. Create the UI as shown below controls and, in the screenshot,
- txt_FirstNum – Textbox Control to Enter First Number
- txt_SecondNum – Textbox Control to Enter Second Number
- lbl_locfirst – Label Control to show variable locFirst
- lbl_locsecond – Label Control to show variable Second
- btnResult - Button Control to calculate the result on select of this button
- lbl_result – Label Control to Show Result variable locTotal
2. Set the variable locFirst of OnChange property of Textbox - txt_FirstNum
UpdateContext({locFirst:txt_FirstNum.Text})
3. Set the variable locSecond of OnChange property of Textbox - txt_SecondNum
UpdateContext({locSecond:txt_SecondNum.Text})
4. Change the Text property of “lbl_locfirst” control to variable “locFirst” as shown below
5. Change the Text property of “lbl_locSecond” control to variable “locSecond” as shown below
6. Now Declare one more local variable “locTotal” on “OnSelect” property of button “btnResult” and assign result of “locFirst + locSecond” as shown below
7. Change the “Text” property of “lblResult” to show variable locTotal as a result as shown below
8. By running the app result will look like this once user enter First Number and Second Number and After clicking on Result Button
Great.........! you learned how to set and use the local variable with Example
Let's learn how global variable works.
2. Global Variable
Scope of variable – Throughout the application and in all screens
Syntax – Set(glbvar, “TestValue”)
Example – In above example we used local variable “locResult” and shown in same screen but if we decide to show result is another screen it will show the below error.
“Name isn’t valid. ‘locTotal’ isn’t recognized.”
To overcome this issue we can use global variable on “OnSelect” property of “btnResult” which we created earlier.
And you will see the result on other screen by using globalvariable “locTotal” as shown below
Yuuupppppp....Now you are ready to apply logic to your project
Happy Coding............:)