Dashlet advanced filtering

hi! I’m trying to filter an Accounts dashlet to get shipping city with one of two values, something like — Palmas OR Tenerife —

I know that works for Global Search but It’s not working on filtering. It returns no records.

I’ve been looking everywhere and watching video tutorials on this subject without success.

I’d also like to know if there is a way to set “negative values”, that is, all the records NOT containing a value, something like NOT Palmas…

any help?

thanks!

I don’t think those kinds of queries are possible, mainly by lack of a UI to create them… of course it’s not complicated to get the queries in SQL to have them.

So you would need to add some code, customize your dashlets, etc.

1 Like

Well, thanks… so I will have to do it by myself! B) B)
Wish me luck! :slight_smile:

Good Luck! :slight_smile:

And don’t forget to come back here and share your solution, or even contribute an enhancement in GitHub.

Recently gymad added the code for improved filters in the List Views. They get stored in the database in table saved_search. Maybe that same code could be extended to work with dashlets - I think that would be the ideal solution.

I’d love to… and please, where are those changes? in what module or files is made filtering?

thanks

There’s a lot of code in many places, it’s not very simple. But the good part is if you can re-use it…

Look in

include/SearchForm (this is where the access to the database happens, to read and write the saved_search table)
modules/SavedSearch

then there’s quite a lot of Javascript for the UI. But if you start from here you can surely find the rest by searching the code.

One way to start this would be to create a saved search in the list view, get it saved in the database, and then try to tweak the code so that that same search would be used to filter the dashlet. If this is possible, then it’s all a matter of UI…

And even if you don’t bother to rewrite the UI to create the search from the dashlets, you can at least give that to your users: a way to re-use saved searches (created in the the List View) in the dashlets. Just a dropdown with the already-existing saved searches for that module.

|Good afternoon.
I am trying to do the same.
Could you solve it?

Regards.