Arithmetic Operations In Power Apps

Power Apps is a suite of apps, services, connectors, and data platforms that provides a rapid application development environment to build custom apps for your business needs. Click here for More Details.

Reading this article, you can learn how to perform arithmetic operations like Addition, Subtraction, Multiplication, Division using Microsoft Power Apps. Also, you will be able to learn Button control, Label control, and TextInput control in the Power Apps environment.

Step 1

Open the URL https://powerapps.microsoft.com/en-us/ in the browser for Power apps,

Arithmetic Operations in Power Apps

Create an account with your Organization Mail ID and login it, After login your Power Apps account,

Arithmetic Operations in Power Apps

Step 2

First, Click Create (+ ) and Select the Canvas app from blank,

Arithmetic Operations in Power Apps

Next, Give the App name as PBArithmatic and Format as Phone.

Arithmetic Operations in Power Apps

Now, In the Power Apps studio environment, Select the Create a form option,

Arithmetic Operations in Power Apps

Arithmetic Operations in Power Apps

Step 3

To perform arithmetic operations, First Rename the Screen name as ScrArith and Rename the Form name as FrmArith,

Arithmetic Operations in Power Apps

Next, Insert a Label control and set the Name and Textproperty as LblNo1 and FirstNumber.

Arithmetic Operations in Power Apps

Similarly, Insert a Label control and set the Name and Textproperty as LblNo2 and SecondNumber.

Arithmetic Operations in Power Apps

Insert 2 TextInput control and set the Nameproperty as TxtNo1 and TxtNo2 and Formatproperty as Number.

Arithmetic Operations in Power Apps

Arithmetic Operations in Power Apps

Insert 2 Label controls and set the Nameproperty as LblResult and LblRes and Textproperty as Result and “” for displaying Results.

Arithmetic Operations in Power Apps

Insert 4 Button controls and set the Nameproperty as BtnAdd, BtnSub, BtnMul, BtnDiv and Textproperty as ADD, SUB,MUL, DIV for performing Arithmetic Operations.

Arithmetic Operations in Power Apps

Set the Following Rules code in the Button controls BtnAdd, BtnSub, BtnMul, BtnDiv in OnSelect Property in Action (click the Advanced) as,

  • UpdateContext({Result: TxtNo1+TxtNo2})
  • UpdateContext({Result: TxtNo1-TxtNo2})
  • UpdateContext({Result: TxtNo1*TxtNo2})
  • UpdateContext({Result: TxtNo1/TxtNo2})

Arithmetic Operations in Power Apps

Next, we can assign the LblRes Text property value as a Result of Button controls.

Arithmetic Operations in Power Apps

Insert a Button control and set the Nameproperty as BtnClear, Textproperty as Clear and OnSelect Property in Action (click the Advanced) as Reset(TxtNo1); Reset(TxtNo2); UpdateContext({Result: 0}) for reset the Text and Label control.

Arithmetic Operations in Power Apps

Finally, the form design looks like,

Arithmetic Operations in Power Apps

Step 4

Now we can see the preview of your App in Power Apps Studio,and output of the PBArithmaticis,

Arithmetic Operations in Power Apps

After clicking the ADD Button,

Arithmetic Operations in Power Apps

After clicking the SUB Button,

Arithmetic Operations in Power Apps

After clicking the MUL Button,

Arithmetic Operations in Power Apps

After clicking the DIV Button,

Arithmetic Operations in Power Apps

After clicking the Clear Button,

Arithmetic Operations in Power Apps

Summary

Now, you have successfully created and tested your arithmetic operations - PBArithmaticin Power Apps Studio environment. 


Similar Articles