Home > Forum > Forms > Filter a data source

Filter a data source
0

I hope I can explain it right... I'm trying to add an autocomplete column to an item list that is filtered on a multi select column.
So I have a projects dictionary, and want to select a project from that.
Each project can have multiple employees working on it, therefore I created a multi-user selection in the project dictionary.

When selecting the project I want to get all projects where my account is in the employees field, like:
Filter: [Employee(Login)] is in [Data source columns(Employees)]

This will give me the project where I am the only one. I need also the project where others are selected as well.
See screenshot...

MVP

Hi Arno,

your filter wont work. The "is in" will check whether the whole string on the left is part of the string array on the right.
abc is in (acbde, abc, area)
In the above example only the middle value will be fulfill the condition.

You can work around this with an advanced filter:
dbo.ClearWFElemIdAdv({COLUMN:WFD_AttChoose2#TaskOwners}) = '{N:CURRENTUSER}'
or
dbo.ClearWFElemIdAdv({COLUMN:WFD_AttChoose2#TaskOwners}) like '{N:CURRENTUSER},%'
or
dbo.ClearWFElemIdAdv({COLUMN:WFD_AttChoose2#TaskOwners}) like '%,{N:CURRENTUSER},%'
or
dbo.ClearWFElemIdAdv({COLUMN:WFD_AttChoose2#TaskOwners}) like '%,{N:CURRENTUSER}'

The {COLUMN:* string is the textual representation of the UI value you can see in the attachment. When you click on the show button you can see how the {COLUMN* is replaced.
The bottom part of the attached image shows which workflows are return for my user which is VM Admin.

More details regarding the query can be found here:
https://daniels-notes.de/posts/2021/series-expert-guide-part-4#where-condition-for-a-single-and-multi-value-field

If you still have the choice I would suggest to move to an item list for the employees. In this case you should be able to use a normal filter. In addition you could add meta data like roles, start/end date and so on. But this is only a suggestion and maybe it's already to late. :)
It could also have less of a perfomance impact joining WFElements and WFElementDetails and doing an exact match is probably faster than three likes and an exact match. But this is just a wild guess

Off topic 1:
Thanks for providing a question which I could actually test myself and provide a solution. :)

Off topic 2:
You should edit your post and replace the current attachment with one where the customer is blurred. ;)


Best regards,
Daniel

In reply to: Daniel Krüger (Cosmo Consult)

Hi Arno,

your filter wont work. The "is in" will check whether the whole string on the left is part of the string array on the right.
abc is in (acbde, abc, area)
In the above example only the middle value will be fulfill the condition.

You can work around this with an advanced filter:
dbo.ClearWFElemIdAdv({COLUMN:WFD_AttChoose2#TaskOwners}) = '{N:CURRENTUSER}'
or
dbo.ClearWFElemIdAdv({COLUMN:WFD_AttChoose2#TaskOwners}) like '{N:CURRENTUSER},%'
or
dbo.ClearWFElemIdAdv({COLUMN:WFD_AttChoose2#TaskOwners}) like '%,{N:CURRENTUSER},%'
or
dbo.ClearWFElemIdAdv({COLUMN:WFD_AttChoose2#TaskOwners}) like '%,{N:CURRENTUSER}'

The {COLUMN:* string is the textual representation of the UI value you can see in the attachment. When you click on the show button you can see how the {COLUMN* is replaced.
The bottom part of the attached image shows which workflows are return for my user which is VM Admin.

More details regarding the query can be found here:
https://daniels-notes.de/posts/2021/series-expert-guide-part-4#where-condition-for-a-single-and-multi-value-field

If you still have the choice I would suggest to move to an item list for the employees. In this case you should be able to use a normal filter. In addition you could add meta data like roles, start/end date and so on. But this is only a suggestion and maybe it's already to late. :)
It could also have less of a perfomance impact joining WFElements and WFElementDetails and doing an exact match is probably faster than three likes and an exact match. But this is just a wild guess

Off topic 1:
Thanks for providing a question which I could actually test myself and provide a solution. :)

Off topic 2:
You should edit your post and replace the current attachment with one where the customer is blurred. ;)


Best regards,
Daniel

Thanks Daniel, I've change my screenshot and removed the names.
As you can see in my screenshot I don't see an option to switch to the advanced filter. Maybe I use a different data source? In my case a dictionary.
Are you using a SQL data source?

Kind regards,

Arno