Generate a Unique ID with Power Fx
Image Source:
Power Apps
Jul 4, 2023 10:00 PM

Generate a Unique ID with Power Fx

by HubSite 365 about Craig White

Talks about #lowcode, #formula1, #powerplatform, #empoweringothers, and #digitaldisruption

Citizen DeveloperPower AppsLearning Selection

I recently worked with a client who wanted a very specific format of unique id for their records. It needed to match their existing system to maintain business

I recently worked with a client who required a uniquely formatted identification code for their business. This ID had to match the format of their pre-existing system, which was made up of four random letters, a hyphen, and four random numbers (XXXX-XXXX).
The task was complicated by the specific requirements: the letters needed to be in uppercase and the numbers needed to be between 1000-9999.
This ruled out the usage of a conventional Auto-Number system, as it is static and not sufficiently dynamic for our needs.

  • We ended up opting for a solution using Microsoft Power Fx, which is a low-code programming language for expressing logic across the Microsoft Power Platform.
  • Our solution involved the use of several Power Fx functions, including Concat, Sequence, Char, RandBetween, and Te.

Among the functions we used, Concat alone is used to join two or more strings into one string. Sequence returns a table of sequential numbers, Char returns a text string that corresponds to a provided number code, and RandBetween returns a random number between the two numbers provided.

Solution with Power Fx

The Power Fx provided a dynamic and efficient solution for generating unique IDs that adhered to the client's specific formatting. With a combination of several functions including Concat - for merging strings, Sequence - for sequential number generation, Char - for generating text corresponding to provided number codes, and RandBetween - for generating random numbers in a given range, this solution successfully catered to the client's complex ID generation needs.

Read the full article Generate a Unique ID with Power Fx

Learn about Generate a Unique ID with Power Fx

Power Fx can be used to generate a Unique ID with a specific format. The format requires 4 randomised capital letters followed by a hyphen, followed by a 4-digit number between 1000-9999. To generate this type of ID, Power Fx needs to be used in combination with the Concat, Sequence, Char, RandBetween & Te functions. Concatenate is used to combine two or more strings, Sequence generates a sequence of numbers, Char converts a number into a character, RandBetween generates a random number between two numbers and Te is used to convert a string to text. These functions can be used together to generate a Unique ID with the desired format.

More links on about Generate a Unique ID with Power Fx

auto generate a unique IDs · Community
You may use Compose action. and guid function as "@guid()". Guid. It will generate the following output. Power Platform. Overview · Power BI · Power Apps ...
How do I lookup a Dataverse row by it's Unique ID
Jun 15, 2022 — I am trying to create a Power Apps formula to lookup a Dataverse row by it's unique ID. This formula works if I look up by the name column:
Generate ID for field that uses "number sequence"
ActivityNumber is the unique id of the activities table in Dynamics 365 for operations and uses number_sequence. And again that field is required,.
How to add SharePoint ID to custom ID in Power Apps
Feb 1, 2023 — I will demonstrate in this blog two methods how to create custom ID based on the SharePoint ID via Power Apps. Option 1 – Form control. I will ...
PowerApps–Generate a Unique ID - Daniel's Blog
Developing a PowerApps App… and needed to generate a unique number for ... get the first 6 characters, Append a “-“ and then generate another GUID and ...
Power Automate: guid function
Feb 10, 2022 — A GUID stands for “Global Unique IDentifier,” and it's what it says ... The guid function will generate a random GUID each time you run the ...


Generate Unique ID, Power Fx, Concat, Sequence, Char, RandBetween