Do you know these PowerFx functions?

PlainText()

  • Strips all HTML formatting from rich text fields.
  • Useful when working with SharePoint rich text fields.

Example:

PlainText(ThisItem.RichTextField)

DataSourceInfo()

  • Retrieves metadata about a data source (e.g., permissions, record limits).
  • Useful for checking if a user has write access to a data source.

Example:

DataSourceInfo(Orders, DataSourceInfo.MaxLength)

DropColumns() & ShowColumns()

  • DropColumns() removes unwanted columns from a table.
  • ShowColumns() keeps only the specified columns.
  • Useful for performance optimization when dealing with large datasets.

Example:

DropColumns(Orders, "InternalNotes", "Timestamp") // Removes unnecessary fields

IsType() & AsType()

  • IsType() checks if a record belongs to a specific entity type.
  • AsType() converts a polymorphic record into a specific entity type.
  • Used mainly in Dataverse when dealing with polymorphic lookups.

Example:

If(IsType(ThisItem, 'Accounts'), "This is an Account", "Not an Account")

Clock.AmPm()

  • Returns "AM" or "PM" based on the current time.
  • Rarely used because Text(Now(), "hh:mm AM/PM") is more common.

Example:

Clock.AmPm() // Returns "AM" or "PM"

RandBetween( lower, upper )

  • Generates a random integer between a specified lower and upper bound.
  • Usage: Useful for randomizing test data or generating random IDs.

Example:

RandBetween(1, 100) // Returns a random number between 1 and 100

Download(Address)

The Download function downloads a file from the web to the local device.

In native players (Windows, Android, and iOS), the user is prompted for a location to save the file.

When used on the web, Download is dependent on the browser’s settings to determine what happens with the file. For images, videos, PDFs, and other file types that the browser natively supports, a new browser tab is opened to display the file. Many browsers support saving the contents to the local file system.

Only on Windows, Download returns the location where the file was stored locally as a text string.

Example:

Download( “https://go.microsoft.com/fwlink/?linkid=827480” )


Discover more from PowerBites

Subscribe to get the latest posts sent to your email.

Leave a comment