
Announcements
Hi everybody,
I have to modify a PowerApp and need some help. We have a SharePoint list with >10k items. ClearCollect is working fine. Now there is another departments SharePoint list we want to use, depending on which department the user is working for. We check on AppStart the department and using var_department.
There are three options:
1. var_departement = "dept1"
2. var_departement = "dept2"
3. var_departement = "dept1 & dept2"
Option 3 should show a popup, where the user needs to select the departements list that should be collected.
To collect the SharePoint list of Departement 1 or 2, I tried this (without any collected items):
If(var_dept = "dept1"; (Concurrent(
ClearCollect(
col_dept1_1;
Filter(
SPO_list_dept1;
Or(
StartsWith(
Batchloading;
"A"
);
StartsWith(
Batchloading;
"B"
)
)
)
);
ClearCollect(
col_dept1_2;
Filter(
SPO_list_dept1;
Or(
StartsWith(
Batchloading;
"C"
);
StartsWith(
Batchloading;
"D"
)
)
)
)
));
false);;
If(var_dept = "dept2"; (Concurrent(
ClearCollect(
col_dept1_1;
Filter(
SPO_list_dept2;
Or(
StartsWith(
Batchloading;
"A"
);
StartsWith(
Batchloading;
"B"
)
)
)
);
ClearCollect(
col_dept1_2;
Filter(
SPO_list_dept2;
Or(
StartsWith(
Batchloading;
"C"
);
StartsWith(
Batchloading;
"D"
)
)
)
)
));
false);;
Concurrent(
ClearCollect(
col_dept;
col_dept1_1;
col_dept1_2))
Any idea how I use the if-statement for var_dept in the beginning the right way?
Thanks!
I have not accounted for all the possibilities but this gives a framework for you to help clarify the options. You can add the options to the with statement and then use the Switch() to indicate which option is valid.
With({option1:Filter(
SPO_list_dept1; Or(
StartsWith(
Batchloading; "A"
); StartsWith(
Batchloading; "B"
)
)
);
option2:Filter(
SPO_list_dept1; Or(
StartsWith(
Batchloading; "C"
); StartsWith(
Batchloading; "D"
)
)
)
};
Switch(
var_dept,"dept1"; option1;
"dept2"; option2
)
)