Hi PowerApps Community,
I'm using 2 sets of code to filter 2 galleries to sort a list of tasks depending on "in progress/not started" and "finished", this works fine for most items in my sharepoint list. The issue is sometimes a tasked wich is marked as Not started OR In progress ends up in the "jobioDone" gallery (the one for the items marked as "Finished") I suppose there is a slight oversight in my second filter code but I cannot find it.
Code/gallery 1:
Sort(
Sort(
Filter(
Search(
AddColumns(
CollectionAllUnitsJobList;
"IDcopy";
Text('Id (ID)')
);
txtSearchBox.Text;
"JOB_SHORT_DESCRIPTION";
"IDcopy"
);
(((User().Email = "example1@biopower.be" || User().Email = "example2@biopower.be") && JOB_WHO.Value = "OPR" && Not(JOB_STATUS.Value = "Finished")) && Not(JOB_Assigned = "Not Assigned") || (User().Email = "example3@biopower.be" && JOB_WHO.Value = "MECH" && Not(JOB_STATUS.Value = "Finished")) || (User().Email = "example4@biopower.be" && JOB_WHO.Value = "HSE" && Not(JOB_STATUS.Value = "Finished")) || ((User().Email <> "example5@biopower.be" || User().Email <> "example6@biopower.be" || User().Email = "example7@biopower.be") && Not(JOB_STATUS.Value = "Finished")) && Not(JOB_Assigned = "Assigned"))
&& (IsBlank(cboFilterLocationStart.SelectedItems.Value) || IsEmpty(cboFilterLocationStart.SelectedItems.Value) || JOB_LOCATION.Value = cboFilterLocationStart.Selected.Value) && (IsBlank(cboFilterWhoStart.SelectedItems.Value) || IsEmpty(cboFilterWhoStart.SelectedItems.Value) || JOB_WHO.Value = cboFilterWhoStart.Selected.Value) && (IsBlank(cboFilterPrioStart.SelectedItems.Value) || IsEmpty(cboFilterPrioStart.SelectedItems.Value) || JOB_PRIORITY.Value = cboFilterPrioStart.Selected.Value) && (IsBlank(cboFilterPartsStart.SelectedItems.Value) || IsEmpty(cboFilterPartsStart.SelectedItems.Value) || JOB_PARTS_PRESENT.Value = cboFilterPartsStart.Selected.Value)
);
"Rijnummer";
SortOrder.Ascending
);
JOB_PRIORITY.Value;
SortOrder.Ascending
)
Code/gallery 2:
Sort(
Sort(
Filter(
Search(
AddColumns(
CollectionAllUnitsJobList;
"IDcopy";
Text('Id (ID)')
);
txtSearchBoxDone.Text;
"JOB_SHORT_DESCRIPTION";
"IDcopy"
);
(((User().Email = "example1@biopower.be" || User().Email = "example2@biopower.be" ) && JOB_WHO.Value = "OPR" &&(JOB_STATUS.Value = "Finished")) ||
(User().Email = "example3@biopower.be" && JOB_WHO.Value = "MECH" && JOB_STATUS.Value = "Finished") ||
(User().Email ="example4@biopower.be" && JOB_WHO.Value = "HSE" && JOB_STATUS.Value = "Finished") ||
((User().Email <> "example5@biopower.be" || User().Email <> "example6@biopower.be" || User().Email = "example7@biopower.be" ) && JOB_STATUS.Value = "Finished")) &&
IsBlank(cboFilterLocationDone.SelectedItems.Value) || IsEmpty(cboFilterLocationDone.SelectedItems.Value) || JOB_LOCATION.Value = cboFilterLocationDone.Selected.Value;
IsBlank(cboFilterWhoDone.SelectedItems.Value) || IsEmpty(cboFilterWhoDone.SelectedItems.Value) || JOB_WHO.Value = cboFilterWhoDone.Selected.Value;
IsBlank(cboFilterPrioDone.SelectedItems.Value) || IsEmpty(cboFilterPrioDone.SelectedItems.Value) || JOB_PRIORITY.Value = cboFilterPrioDone.Selected.Value;
IsBlank(cboFilterPartsDone.SelectedItems.Value) || IsEmpty(cboFilterPartsDone.SelectedItems.Value) || JOB_PARTS_PRESENT.Value = cboFilterPartsDone.Selected.Value
);
"Rijnummer";
SortOrder.Ascending
);
JOB_PRIORITY.Value;
SortOrder.Ascending
)
Any idea's?
Kind regards,
Sébastien
Hi,
Thanks for your reply,
I found the error, whilst creating a task (filling out a form and submitting it), I connected the input of a wrong combo box resulting a false value being written to the tasks.
Hi @PonceletSeba ,
Do you mean some items with Job Status = "Finished" turn up in Gallery2 than Gallery1? Are they in Gallery1 as well? I also cannot find the reason why items that are not finished turn up in this Gallery,but you may try below formula instead:
Sort(
Sort(
Filter(
Filter(
Search(
AddColumns(
CollectionAllUnitsJobList;
"IDcopy";
Text('Id (ID)')
);
txtSearchBoxDone.Text;
"JOB_SHORT_DESCRIPTION";
"IDcopy"
);
(((User().Email = "example1@biopower.be" || User().Email = "example2@biopower.be" ) && JOB_WHO.Value = "OPR" ) ||
(User().Email = "example3@biopower.be" && JOB_WHO.Value = "MECH" ) ||
(User().Email ="example4@biopower.be" && JOB_WHO.Value = "HSE" ) ||
(User().Email <> "example5@biopower.be" || User().Email <> "example6@biopower.be" || User().Email = "example7@biopower.be" )) &&
IsBlank(cboFilterLocationDone.SelectedItems.Value) || IsEmpty(cboFilterLocationDone.SelectedItems.Value) || JOB_LOCATION.Value = cboFilterLocationDone.Selected.Value;
IsBlank(cboFilterWhoDone.SelectedItems.Value) || IsEmpty(cboFilterWhoDone.SelectedItems.Value) || JOB_WHO.Value = cboFilterWhoDone.Selected.Value;
IsBlank(cboFilterPrioDone.SelectedItems.Value) || IsEmpty(cboFilterPrioDone.SelectedItems.Value) || JOB_PRIORITY.Value = cboFilterPrioDone.Selected.Value;
IsBlank(cboFilterPartsDone.SelectedItems.Value) || IsEmpty(cboFilterPartsDone.SelectedItems.Value) || JOB_PARTS_PRESENT.Value = cboFilterPartsDone.Selected.Value
)
JOB_STATUS.Value = "Finished"
);
"Rijnummer";
SortOrder.Ascending
);
JOB_PRIORITY.Value;
SortOrder.Ascending
)
Best regards
WarrenBelz
146,524
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,906
Most Valuable Professional