Power Apps Formulas: A Practical Introduction

Power Apps formulas are the building blocks of app functionality, enabling users to create powerful applications with minimal code.

What Are Power Apps Formulas?

Power Apps formulas are instructions you provide to Power Apps so it can execute actions. They are the equivalent of writing code in traditional programming languages, but much simpler.

Since Power Apps is a low-code platform, formulas allow you to build apps with minimal coding effort. In fact, they are more similar to Excel formulas than to traditional programming syntax.

Basic Examples

Concatenate Formula

By using the Concatenate function, you can combine text from multiple inputs:

Concatenate(TextInput3.Text, " ", TextInput4.Text)

This joins the content of two text inputs with a blank space in between. In Excel, this would be similar to:

=CONCATENATE(A1, " ", B1)

Length Formula

The Len function calculates the number of characters in a text input:

Len(TextInput4.Text)

Just like Excel’s =LEN(A1), it returns the length of the text in the specified control.

Conditional Logic

Power Apps supports conditional formulas using the If function. For example:

If(Value(TextInput4.Text) > 10, "High", "Low")

This checks if the numeric value in a text input is greater than 10. If true, it returns “High”; otherwise, “Low”. In Excel, this is similar to:

=IF(A1>10, "High", "Low")

Navigation and Control

Navigate Function

You can move between screens using the Navigate function:

Navigate(Screen2)

Reset Function

To clear the content of a text input, use the Reset function:

Reset(TextInput3)

Notify Function

To display messages to users, use the Notify function with conditions:

If(IsBlank(TextInput4.Text), Notify("Please enter a value", NotificationType.Error))

Working with Variables

Power Apps allows you to create global variables using the Set function:

Set(UserName, "Hi friend")

This stores the value “Hi friend” in a variable called UserName, which can be used across different screens.

Connecting to Data Sources

Power Apps formulas can connect to external data sources like SharePoint, Excel, and Dataverse.

Gallery Example

Mapping a gallery to a Dataverse table:

Items = Products

Filtering Data

To filter products with a price higher than 700:

Filter(Products, Price > 700)

Sorting Data

To sort products by price in ascending order:

SortByColumns(Products, "Price", Ascending)

Lookup Function

To find a specific product by name:

Lookup(Products, Name = "Smartphone")

Conclusion

Power Apps formulas make app development accessible by combining the simplicity of Excel formulas with the flexibility of programming logic.

From text manipulation and conditional checks to navigation, variable management, and data integration, formulas are at the heart of building functional and dynamic applications in Power Apps.

Comments

Leave a Comment

Your email address will not be published. Required fields are marked *