For  the sort dropdown

Chapter - 06

Visit to buy the book on Citizen Development https://go.citizendeveloper.codes/buynow

Code Snippet #4

For the sort dropdown

This code snippet uses the ClearCollect function to create a collection named locSortDropdown and populate it with a table of data.

   ClearCollect(
        locSortDropdown,
        Table(
            {
                DisplayColumn: "No sort", ColumnName: ""
            },
            {
                DisplayColumn: "State", ColumnName: "State"
            },
            {
                DisplayColumn: "Friend Name", ColumnName: "FriendName"
            },
            {
                DisplayColumn: "Last Updated", ColumnName: "LastUpdated"
            }
        )
    );

Explanation

  • ClearCollect Function: - ClearCollect(collectionName, items...): This function clears any existing data in the specified collection (collectionName) and then collects the items into it. In your code, locSortDropdown is the name of the collection being created or updated.

  • Table Function: - Table(...) is used to create a table with the specified records. Each record is defined within curly braces {}.

  • Records in the Table: - The table created in your code consists of four records, each with two properties: DisplayColumn and ColumnName.

    • { DisplayColumn: "No sort", ColumnName: "" }: The first record. DisplayColumn is a label that might be displayed in the UI, and ColumnName is an empty string, indicating no sorting.
    • { DisplayColumn: "State", ColumnName: "State" }: The second record. This indicates that items can be sorted by a column named “State”.
    • { DisplayColumn: "Friend Name", ColumnName: "FriendName" }: The third record for sorting by a “FriendName” column.
    • { DisplayColumn: "Last Updated", ColumnName: "LastUpdated" }: The fourth record for sorting by a “LastUpdated” column.

In summary, this code is creating a collection named locSortDropdown which is intended to be used for a sorting dropdown control in a Power Apps canvas screen. The collection contains options for sorting data by different columns (like “State”, “Friend Name”, and “Last Updated”), as well as an option for ‘No sort’. The DisplayColumn values are what will be shown to the user in the dropdown, while the ColumnName values probably correspond to the actual column names in the data source that the sorting will be applied to.

Happy #low-code learning

Visit: www.citizendeveloper.codes

Id: Chapter-06-CS00004

Category: Chapter 06

Amit Puri, Advisor and Consultant, Strengthening Digital Experiences, Modernize Cloud Journey with AI-Driven Transformation!

Code Snippet # 6
Chapter-08-CS00006 - Code Snippet # 6
Code Snippet # 9
Chapter-08-CS00009 - Code Snippet # 9
Code Snippet # 8
Chapter-08-CS00008 - Code Snippet # 8