Hi Folks,
Built some Apps earlier in the year that are logs. They filter by month in a drop down and it defaults to the current month. With a new year coming up, I am trying to implement a year drop down filter as well, but I can't seem to get it to work.
I am learning so I know this code is probably not as efficient as it could be (also these are relatively small datasets so delegation doesn't matter).
In the screens OnVisible I create 2 collections, one for months and one for years.
ClearCollect(collMonths,
{ID:0,Name:""},
{ID:1,Name:"Jan"},
{ID:2,Name:"Feb"},
{ID:3,Name:"Mar"},
{ID:4,Name:"Apr"},
{ID:5,Name:"May"},
{ID:6,Name:"Jun"},
{ID:7,Name:"Jul"},
{ID:8,Name:"Aug"},
{ID:9,Name:"Sep"},
{ID:10,Name:"Oct"},
{ID:11,Name:"Nov"},
{ID:12,Name:"Dec"});
ClearCollect(collYears,
{ID:1,Name:"2022"},
{ID:2,Name:"2023"});
In the gallery, I have this code set:
If(
chkShowResolved.Value = false,
SortByColumns(
Search(
Filter(
'Work Orders',
And(
Or(
IsEmpty(cboLogPriority.SelectedItems),
IsBlank(cboLogPriority.SelectedItems),
Priority in cboLogPriority.SelectedItems
),
Month('Log Date') = ddMonth.Selected.ID,
//Year('Log Date') = ddYear.Selected.ID,
'WO Status' <> "Resolved"
)
),
inpSearch.Text,
"cscit_description"
),
varSortColumn,
varSortDirection
),
SortByColumns(
Search(
Filter(
'Work Orders',
And(
Or(
IsEmpty(cboLogPriority.SelectedItems),
IsBlank(cboLogPriority.SelectedItems),
Priority in cboLogPriority.SelectedItems
),
Month('Log Date') = ddMonth.Selected.ID
)
),
inpSearch.Text,
"cscit_description"
),
varSortColumn,
varSortDirection
)
)
If I uncomment out that year dropdown filter, the gallery is blank. Using labels to see return values I am getting the correct IDs and years back from the drop down but the gallery is still blank. Help please!