Different users need different views of the same data. A project manager might want to see tasks sorted by priority, while a developer prefers due dates. Instead of creating multiple static drop-downs, let users choose their own sorting perspective dynamically.
When drop-downs contain data from tables with multiple meaningful columns, users benefit from controlling the sort order themselves. This goes beyond simple alphabetical listing — it’s about presenting information in the sequence that matches each person’s immediate needs.
The sorting challenge
Consider a task management scenario where your data table contains rich information about each task. Static alphabetical sorting often isn’t useful when users need to focus on urgency, importance or project groupings.
Here’s a task data table stored in a hidden form screen named TaskData and created using our data editor:
TaskName | ProjectName | Priority | DueDate | Status |
---|---|---|---|---|
Website Redesign | Marketing Site | 1 | 2025-10-15 | In Progress |
Database Migration | Backend Upgrade | 1 | 2025-10-08 | Blocked |
User Testing | Mobile App | 2 | 2025-10-20 | Not Started |
Documentation Update | API Project | 3 | 2025-10-25 | In Progress |
Security Audit | Backend Upgrade | 1 | 2025-10-12 | Not Started |
Logo Design | Marketing Site | 2 | 2025-10-18 | Complete |
API Development | API Project | 2 | 2025-10-22 | In Progress |
Mobile Optimization | Mobile App | 3 | 2025-10-30 | Not Started |
Performance Review | Backend Upgrade | 1 | 2025-10-10 | Complete |
Content Strategy | Marketing Site | 3 | 2025-10-28 | Not Started |
Priority values follow the convention where 1 is high, 2 is medium and 3 is low.
Creating dynamic sort options
Success depends on offering sort options that match real workflow scenarios. Create a text drop-down field named SortBy with these choices:
- Priority (high to low) — Start with urgent tasks.
- Priority (low to high) — Focus on quick wins first.
- Due date (newest first) — See long-term planning perspective.
- Due date (oldest first) — Identify overdue and immediate deadlines.
- Task name (A-Z) — Find specific tasks quickly.
- Task name (Z-A) — Alternative alphabetical view.
- Project name (A-Z) — Group by project for coordination.
- Project name (Z-A) — Alternative project grouping.
Example: Dynamic task sorting
Here’s a demo app showing dynamic sorting in action:
Select different sort options to see how both the Tasks and Projects drop-downs reorganize based on your choice. Notice how “Priority (high to low)” shows urgent tasks first, while “Due date (oldest first)” highlights approaching deadlines.
Implementation with SORTBY
Use SORTBY to sort one column based on values in another column. For a drop-down showing task names sorted by the selected criteria, associate this formula with the Values property:
(low to high)", SORTBY(TaskData!TaskName, TaskData!Priority, SortOrder.Descending), "Due date (newest first)", SORTBY(TaskData!TaskName, TaskData!DueDate, SortOrder.Descending), "Due date (oldest first)", SORTBY(TaskData!TaskName, TaskData!DueDate, SortOrder.Ascending), "Task name
(A-Z)", SORTBY(TaskData!TaskName, TaskData!TaskName, SortOrder.Ascending), "Task
name (Z-A)", SORTBY(TaskData!TaskName, TaskData!TaskName, SortOrder.Descending), "Project name (A-Z)", SORTBY(TaskData!TaskName, TaskData!ProjectName, SortOrder.Ascending), "Project name (Z-A)", SORTBY(TaskData!TaskName, TaskData!ProjectName, SortOrder.Descending), TaskData!TaskName)SWITCH(SortBy; "Priority (high to low)"; SORTBY(TaskData!TaskName; TaskData!Priority; SortOrder,Ascending); "Priority
(low to high)"; SORTBY(TaskData!TaskName; TaskData!Priority; SortOrder,Descending); "Due date (newest first)"; SORTBY(TaskData!TaskName; TaskData!DueDate; SortOrder,Descending); "Due date (oldest first)"; SORTBY(TaskData!TaskName; TaskData!DueDate; SortOrder,Ascending); "Task name
(A-Z)"; SORTBY(TaskData!TaskName; TaskData!TaskName; SortOrder,Ascending); "Task
name (Z-A)"; SORTBY(TaskData!TaskName; TaskData!TaskName; SortOrder,Descending); "Project name (A-Z)"; SORTBY(TaskData!TaskName; TaskData!ProjectName; SortOrder,Ascending); "Project name (Z-A)"; SORTBY(TaskData!TaskName; TaskData!ProjectName; SortOrder,Descending); TaskData!TaskName)
The SWITCH function handles each sort option, while SORTBY does the actual sorting work:
- First parameter: The array to sort (TaskName).
- Second parameter: The array containing sort criteria (Priority, DueDate, etc.).
- Third parameter: SortOrder.AscendingSortOrder,Ascending or SortOrder.DescendingSortOrder,Descending.
For priority sorting, “high to low” uses ascending order because priority 1 (high) comes before priority 3 (low) numerically.
Multiple perspectives on the same data
The real power emerges when you provide multiple drop-downs that all respond to the same sort control. A second drop-down showing project names uses an identical pattern:
(low to high)", SORTBY(TaskData!ProjectName, TaskData!Priority, SortOrder.Descending), "Due date (newest first)", SORTBY(TaskData!ProjectName, TaskData!DueDate, SortOrder.Descending), "Due date (oldest first)", SORTBY(TaskData!ProjectName, TaskData!DueDate, SortOrder.Ascending), "Task name
(A-Z)", SORTBY(TaskData!ProjectName, TaskData!TaskName, SortOrder.Ascending), "Task name (Z-A)", SORTBY(TaskData!ProjectName, TaskData!TaskName, SortOrder.Descending), "Project name (A-Z)", SORTBY(TaskData!ProjectName, TaskData!ProjectName, SortOrder.Ascending), "Project name (Z-A)", SORTBY(TaskData!ProjectName, TaskData!ProjectName, SortOrder.Descending), TaskData!ProjectName)SWITCH(SortBy; "Priority (high to low)"; SORTBY(TaskData!ProjectName; TaskData!Priority; SortOrder,Ascending); "Priority
(low to high)"; SORTBY(TaskData!ProjectName; TaskData!Priority; SortOrder,Descending); "Due date (newest first)"; SORTBY(TaskData!ProjectName; TaskData!DueDate; SortOrder,Descending); "Due date (oldest first)"; SORTBY(TaskData!ProjectName; TaskData!DueDate; SortOrder,Ascending); "Task name
(A-Z)"; SORTBY(TaskData!ProjectName; TaskData!TaskName; SortOrder,Ascending); "Task name (Z-A)"; SORTBY(TaskData!ProjectName; TaskData!TaskName; SortOrder,Descending); "Project name (A-Z)"; SORTBY(TaskData!ProjectName; TaskData!ProjectName; SortOrder,Ascending); "Project name (Z-A)"; SORTBY(TaskData!ProjectName; TaskData!ProjectName; SortOrder,Descending); TaskData!ProjectName)
Now users can see both task names and project names sorted by the same criteria, providing complementary views of their data. When they select “Priority (high to low),” both drop-downs reorganize to show high-priority items first.
This approach transforms static data display into an interactive tool that adapts to different working styles and priorities.
Note: This technique requires named values, which are not available in our Starter plans.