On the OnStart of the application I have the following piece of code:
ClearCollect(
colViews,
{
ViewName: "My Projects",
ViewColumns: [
"ID",
"Title",
"Requested by Section",
"Point of Contact in Section",
"Location of Work",
"Brief description of the work",
"Requested Start Date",
"Estimated End Date",
"Approval Status"
]
},
{
ViewName: "All Projects",
ViewColumns: [
"ID",
"Title",
"Requested by Section",
"Point of Contact in Section",
"Location of Work",
"Brief description of the work",
"Requested Start Date",
"Estimated End Date",
"Approval Status"
]
},
{
ViewName: "Pending Approval",
ViewColumns: [
"ID",
"Title",
"Requested by Section",
"Point of Contact in Section",
"Location of Work",
"Brief description of the work",
"Requested Start Date",
"Estimated End Date",
"Approval Status"
]
},
{
ViewName: "Approved by MGT",
ViewColumns: [
"ID",
"Title",
"Requested by Section",
"Point of Contact in Section",
"Location of Work",
"Brief description of the work",
"Requested Start Date",
"Estimated End Date",
"Approval Status"
]
},
);
Set(varSortColumn,"ID");
Set(varSortDirection,Descending);
Navigate(HomeScreen)
For my datatable on Items I have the following code:
Switch(
Dropdown.Selected.ViewName,
"My Projects",
SortByColumns(
Filter(
'Projects',
StartsWith(
Title,
SearchBox.Text
) && 'Created By'.Email = User().Email || StartsWith(
'Brief description of the work',
SearchBox.Text
) && 'Created By'.Email = User().Email || StartsWith(
'Location of Work',
SearchBox.Text
) && 'Created By'.Email = User().Email
),
varSortColumn,
varSortDirection
),
"All Projects",
SortByColumns(
Search(
'Projects',
SearchBox.Text,
"Title",
"Briefdescriptionofthework",
"LocationofWork"
),
varSortColumn,
varSortDirection
),
"Pending Approval",
SortByColumns(
Filter(
'Projects',
StartsWith(
Title,
SearchBox.Text
) && 'Approval Status' = "Pending Approval"
),
varSortColumn,
varSortDirection
),
"Approved by MGT",
SortByColumns(
Filter(
'Projects',
StartsWith(
Title,
SearchBox.Text
) && 'Approval Status' = "Approved by MGT"
),
varSortColumn,
varSortDirection
)