Hey guys,
I have a PowerApp that filters employee within the company. There's some accounts from my Office365 that do not have a department.
When filtering, my dropdown has an empty item ([""]) which reads all departments, but I don't want the accounts with an empty department to be viewable within the gallery.
Is there any way of doing this?
Thanks in advance!
Solved! Go to Solution.
Give this a crack?
I'm assuming ddDepartment.Selected.Value <> "" was your first attempt to check if department value is blank.
Else just add it in as a new condition to your filter.
Filter(
Office365Users.SearchUser(
{searchTerm:txtInputEmployee.Text, top: 500})
, AccountEnabled = true,
If(Len(ddDepartment.Selected.Value) > 0,
Department = ddDepartment.Selected.Value,true)
)
Hi @SilvesterP,
I have found a solution using your solution:
Filter( Office365Users.SearchUser( { searchTerm: txtInputEmployee.Text, top: 500 } ), AccountEnabled = true, If( Len(Department) < 1, Department = ddDepartment.Selected.Value, true ), If( ddDepartment.Selected.Value <> "", Department = ddDepartment.Selected.Value, true ) )
Thank you very much for the assistance, much apprciated!!
Hey Andy,
I would do a filter where the length of the department is not null. Filter(DataSource, Len(datasourcefield) > 0)
Example
Hey Andy,
I would do a filter where the length of the department is not null. Filter(DataSource, Len(datasourcefield) > 0)
Example
Hi @SilvesterP ,
Thanks for your response.
How can I incorporate that function into this function for my Gallery:
Filter(Office365Users.SearchUser({searchTerm:txtInputEmployee.Text, top: 500}), AccountEnabled = true, If(ddDepartment.Selected.Value <> "",Department = ddDepartment.Selected.Value,true))
In the dropdown menu I have values in as ["","IT","Accounting",etc.]
Kind Regards,
Andy.
Give this a crack?
I'm assuming ddDepartment.Selected.Value <> "" was your first attempt to check if department value is blank.
Else just add it in as a new condition to your filter.
Filter(
Office365Users.SearchUser(
{searchTerm:txtInputEmployee.Text, top: 500})
, AccountEnabled = true,
If(Len(ddDepartment.Selected.Value) > 0,
Department = ddDepartment.Selected.Value,true)
)
So I tried it, and I get the same result.
The accounts with Departments that are empty are still displaying.
But I used this and it shows only the accounts that have no department:
Filter(
Office365Users.SearchUser(
{searchTerm:txtInputEmployee.Text, top: 500}),
AccountEnabled = true,
If(Len(Department) > 0,
Department = ddDepartment.Selected.Value,true)
)
But I want to view the accounts that have a department in the Office365 contacts if you understand what I mean?
Sorry if it's a little confusing.
So I tried it, and I get the same result.
The accounts with Departments that are empty are still displaying.
But I used this and it shows only the accounts that have no department:
Filter(
Office365Users.SearchUser(
{searchTerm:txtInputEmployee.Text, top: 500}),
AccountEnabled = true,
If(Len(Department) > 0,
Department = ddDepartment.Selected.Value,true)
)
But I want to view the accounts that have a department in the Office365 contacts if you understand what I mean?
Sorry if it's a little confusing @SilvesterP .
Hi @SilvesterP,
I have found a solution using your solution:
Filter( Office365Users.SearchUser( { searchTerm: txtInputEmployee.Text, top: 500 } ), AccountEnabled = true, If( Len(Department) < 1, Department = ddDepartment.Selected.Value, true ), If( ddDepartment.Selected.Value <> "", Department = ddDepartment.Selected.Value, true ) )
Thank you very much for the assistance, much apprciated!!
User | Count |
---|---|
139 | |
129 | |
76 | |
72 | |
70 |
User | Count |
---|---|
212 | |
200 | |
64 | |
63 | |
54 |