We will understand and learn to shuffle the data in a collection using Shuffle () function in Canvas App. Before we start, make sure to subscribe to CRM Crate so that you can stay up to date in the field of Power Platform.
What is Power FX?
Microsoft’s Power Fx is the low-code language that will be used across Power Platform. It’s a strong-typed, general-purpose, declarative, and functional programming language. Power Fx is expressed in user-friendly text. It’s a low-code language that citizen developers & makers can work with directly in an Excel-like formula bar or Visual Studio Code text window.
It enables a complete range of development from no-code for those who have never programmed before to “pro-code” for the seasoned professional, with no learning or rewriting cliffs in between, enabling diverse teams to collaborate and save time and expense.
Understanding Shuffle function in Power Apps
Syntax:
Shuffle( Table )
This function is used to randomly re-order the rows or records of a table or collection. Shuffle returns a table that has the same columns and number of rows as the argument.
Example:
- Sometimes we need to mix the data of a collection or a table as per business needs. Consider a real-time example of quizzes where we need to shuffle the sequence of answers every time the quiz gets launched. Such requirements can be fulfilled using the Shuffle () Power FX function.
ClearCollect( NewCollection, Shuffle(Collection))
This function will collect the data from input collection, shuffle it and return the mixed data to a new collection.
- The below animation represents the implementation and usage of Shuffle () Power F X function in Canvas App.