Log function from Power Fx using Power Apps

Introduction

Power Apps is a suite of apps, services, connectors, and data platforms that provide a rapid application development environment to build custom apps for your business needs. More Details https://docs.microsoft.com/en-us/powerapps/powerapps-overview.

Power Fx is the low-code language that will be used across the Microsoft Power Platform. It's a general-purpose, strong-typed, declarative, and functional programming language.

The Log Power Fx function in Power Apps returns the logarithm of its first argument in the base specified by its second argument. If the second argument is not specified, the default base is 10.

Reading this article, you can learn how to perform the Log function from Power Fx 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,

Create an account with your Organisation Mail ID and log in. After login your Power Apps account,

PowerApps Account

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

Create app

Blank canvas app

Next, Give the App name as PAPFLog and the Format as Tablet.

Create app from blank

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

PowerApps Studio

Step 3. To test the Log function, First Rename the Screen name as SCRPAPF

Tree view screens

Next, Insert  a Label control and set the Name and Text property as LblTitle and Log function in canvas App using PowerFx with Power apps

Text label

Next, Insert a Label control, set the Name and Text property as LblNum, and Enter the Number.

Text label

Insert  a TextInput control and set the Name property as TxtNum and Format property as Number

Insert text label

Next, Insert  a Label control, set the Name and Text property as LblBase, and Enter the Base Value :

Text label

Insert  a TextInput control and set the Name property as TxtBase and Format property as Number

TextInput control

Insert  a Button control and set the Name property as BtnCal and Text property as Calculate and set OnSelect action as UpdateContext({RES:(TxtNum)});UpdateContext({RESB:(TxtBase)});  for testing Log function in Power Fx

Button

Insert Label control and set the Name property as LblDBRes and Text property as "Log Value with Default Base(10):  " &Log(RES.Text) for displaying Results

Insert Label control

Insert Label control and set the Name property as LblDBRes_1 and Text property as "Log Value with Specific Base Value:  " &Log(RES.Text,RESB.Text) for displaying Results

set the Name property

Insert  a Button control and set the Name property as BtnClr, Text property as Clear, and OnSelect  Property in Action as Reset(TxtNum); Reset(TxtBase); UpdateContext({LblDBRes:""}); UpdateContext({LblDBRes_1:""}); for reset the Text and Result

Clear button

Finally, the form design looks like,

Function

Step 4. Now we can see the preview of your App in Power Apps Studio, and The output of the PAPFLog is,

Output

After clicking the Calculate Button,

The Browser Display is,

Browser Display

The Tablet Display is,

Tablet display

The Apple iPhone Display is,

Apple iPhone

After clicking the Clear Button,

Clear button

Summary

Now, you have successfully tested the Power Fx - Log function in the Power Apps Studio environment. 


Similar Articles