@AuburnMist Regarding your formula:
//pseudo-formula, untested, adjust as needed
SortByColumns
(
Filter
(
Switch
(
cmbFiscalYear.Selected.Value
,"2021/2022"
,EmployeeLeave2021/2022
,"2022/2023"
,EmployeeLeave2022/2023
)
,EmployeeName = galSelectEmployee.Selected.Result
&& StartDate >= 'date(From)Leave'.Value,
&& StartDate <= 'date(To)Leave'.Value
&&
(
AbsenceType.Value = cmbAbsenceType.Selected.Value
|| cmbAbsenceType.Selected.Value = Blank()
)
&&
(
Status.Value = cmbStatus.Selected.Value
|| cmbStatus.Selected.Value = Blank()
)
)
,"StartDate"
,If
(
SortDescending
,Ascending
,Descending
)
)
Although I did not test it, the formula that you gave seems to be correct in terms of syntax. If not, see if using the above version works better, but I think it is probably identical to the one you gave.
To resolve the issue, you could try this:
1. Try using only one of the data sources by themselves. First try EmployeeLeave2021/2022. Then try just EmployeeLeave2022/2023. See which one gives the error, or see if both give the error.
//pseudo-formula, untested, adjust as needed
SortByColumns
(
Filter
(
EmployeeLeave2021/2022
,EmployeeName = galSelectEmployee.Selected.Result
....
2. If just one gives the error, which I suspect it might do, let's suppose for example only EmployeeLeave2022/2023 - then make a note which one gives the error.
3. Based on the error, try revising your formula like this:
//pseudo-formula, untested, adjust as needed. Replace YourTableName with the name of the data source it is complaining about.
...
,YourTableName[@EmployeeName] = galSelectEmployee.Selected.Result
...
4. If the above does not work, then EmployeeName is not actually the name of the field, and it only seemed like the two lists were identical, but were not. See what field it really wants for just EmployeeLeave2022/2023 . Let's suppose for sake of example it is just EmplName . If so, then try this:
//pseudo-formula, untested, adjust as needed
SortByColumns
(
Filter
(
Switch
(
cmbFiscalYear.Selected.Value
,"2021/2022"
,EmployeeLeave2021/2022
,"2022/2023"
,EmployeeLeave2022/2023
)
,Switch
(
cmbFiscalYear.Selected.Value
,"2021/2022"
,EmployeeName = galSelectEmployee.Selected.Result
,"2022/2023"
,EmplName = galSelectEmployee.Selected.Result
)
......
5. If the above does not work, try using the disambiguation operator once more to see if it works:
//pseudo-formula, untested, adjust as needed
SortByColumns
(
Filter
(
Switch
(
cmbFiscalYear.Selected.Value
,"2021/2022"
,EmployeeLeave2021/2022
,"2022/2023"
,EmployeeLeave2022/2023
)
,Switch
(
cmbFiscalYear.Selected.Value
,"2021/2022"
,EmployeeLeave2021/2022[@EmployeeName] = galSelectEmployee.Selected.Result
,"2022/2023"
,EmployeeLeave2022/2023[@EmployeeName] = galSelectEmployee.Selected.Result
)
......
6. If nothing like the above works, or you keep on getting more and more errors that all have to be individually fixed with more of the same kind of switch statements like the above on more clauses, then switching on every variation on so many clauses may end up seriously becoming more cumbersome and difficult to maintain, than just outright repeating the whole giant formula again by switching on the entire thing instead. If that ends up working better for you, then you should try that instead:
//pseudo-formula, untested, adjust as needed
Switch
(
cmbFiscalYear.Selected.Value
,"2021/2022"
,SortByColumns
(
Filter
(
EmployeeLeave2021/2022
,EmployeeName = galSelectEmployee.Selected.Result
&& StartDate >= 'date(From)Leave'.Value,
&& StartDate <= 'date(To)Leave'.Value
&&
(
AbsenceType.Value = cmbAbsenceType.Selected.Value
|| cmbAbsenceType.Selected.Value = Blank()
)
&&
(
Status.Value = cmbStatus.Selected.Value
|| cmbStatus.Selected.Value = Blank()
)
)
,"StartDate"
,If
(
SortDescending
,Ascending
,Descending
)
)
,"2022/2023"
,SortByColumns
(
Filter
(
EmployeeLeave2022/2023
,EmployeeName = galSelectEmployee.Selected.Result //adjust as needed
&& StartDate >= 'date(From)Leave'.Value, //adjust as needed
&& StartDate <= 'date(To)Leave'.Value //adjust as needed
&&
(
AbsenceType.Value = cmbAbsenceType.Selected.Value //adjust as needed
|| cmbAbsenceType.Selected.Value = Blank() //adjust as needed
)
&&
(
Status.Value = cmbStatus.Selected.Value //adjust as needed
|| cmbStatus.Selected.Value = Blank() //adjust as needed
)
)
,"StartDate" //adjust as needed
,If //adjust as needed
(
SortDescending //adjust as needed
,Ascending //adjust as needed
,Descending //adjust as needed
)
)
)
See if it helps @AuburnMist