Bhubaneswar, Odisha, India
+91-8328865778
support@softchief.com

Commonly used PowerFX Functions in Custom Pages Power Platform

Commonly used PowerFX Functions in Custom Pages Power Platform

Introduction

Power Fx is a versatile formula language used in Power Apps, enabling the creation of dynamic and interactive user experiences. This guide covers commonly used Power Fx functions tailored for custom pages within Power Apps.

1. Text Functions

Text

Converts a value to text.

Text(123.45)

Concat

Concatenates a table of text values into a single string.

Concat(Table({Value: "Hello"}, {Value: "World"}), Value, " ")

Concatenate

Joins multiple strings together.

Concatenate("Hello", " ", "World")

2. Date and Time Functions

Now

Returns the current date and time.

Now()

Today

Returns the current date.

Today()

DateAdd

Adds a specified number of units to a date/time value.

DateAdd(Today(), 5, Days)

3. Math Functions

Sum

Adds up values in a table.

Sum([1, 2, 3, 4, 5])

Round

Rounds a number to the specified number of decimal places.

Round(123.456, 2)

Abs

Returns the absolute value of a number.

Abs(-123)

4. Logical Functions

If

Conditionally evaluates and returns values.

If(TextInput1.Text = "Admin", "Welcome Admin", "Welcome User")

Switch

Matches a value to a set of values and returns the corresponding result.

Switch(Dropdown1.Selected.Value, "1", "One", "2", "Two", "Other")

And

Returns true if all arguments are true.

And(TextInput1.Text = "Admin", Checkbox1.Value)

Or

Returns true if any argument is true.

Or(TextInput1.Text = "Admin", Checkbox1.Value)

5. Lookup Functions

LookUp

Finds the first record in a table that satisfies a condition.

LookUp(Accounts, AccountNumber = "A123")

Filter

Returns a filtered table based on a condition.

Filter(Accounts, City = "Seattle")

Search

Searches a table for records that contain a string in one of their columns.

Search(Accounts, "Contoso", "AccountName")

6. Table Functions

AddColumns

Adds calculated columns to a table.

AddColumns(Accounts, "AccountValue", AccountBalance * 1.1)

RenameColumns

Renames columns in a table.

RenameColumns(Accounts, "oldName", "newName")

DropColumns

Removes columns from a table.

DropColumns(Accounts, "oldName")

7. Collections and Data Sources

Collect

Creates or adds records to a collection.

Collect(MyCollection, {Name: "John", Age: 30})

ClearCollect

Clears a collection and then adds records.

ClearCollect(MyCollection, {Name: "John", Age: 30})

Remove

Removes a record from a collection.

Remove(MyCollection, First(MyCollection))

8. Control Properties

Visible

Determines the visibility of a control.

If(Dropdown1.Selected.Value = "Show", true, false)

Enabled

Enables or disables a control.

If(User().Email = "admin@example.com", true, false)

Examples in Custom Pages

Conditional Formatting

Change the color of a label based on a condition.

If(TextInput1.Text = "Error", Color.Red, Color.Green)

Dynamic Dropdown Options

Populate a dropdown based on another dropdown selection.

Filter(Cities, Country = Dropdown1.Selected.Value)

Form Validation

Enable the submit button only if all required fields are filled.

And(!IsBlank(TextInput1.Text), !IsBlank(TextInput2.Text))

Read more details Here https://learn.microsoft.com/en-us/power-apps/maker/model-driven-apps/page-powerfx-in-model-app

Hope it helps