# Creating a Custom Filter by scraping

**URL:** <https://gramps.discourse.group/t/creating-a-custom-filter-by-scraping/2826>\
**Category:** Development\
**Created:** [October 4, 2022, 2:15pm UTC](https://gramps.discourse.group/t/creating-a-custom-filter-by-scraping/2826 "2022-10-04T14:15:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![emyoulation](https://yyz2.discourse-cdn.com/free1/user_avatar/gramps.discourse.group/emyoulation/32/67_2.png) [@emyoulation](https://gramps.discourse.group/u/emyoulation)\
**Post date:** [October 4, 2022, 2:15pm UTC](https://gramps.discourse.group/t/creating-a-custom-filter-by-scraping/2826/1 "2022-10-04T14:15:59Z")

</div>

Kari is developing a new functionality in SuperTool. This feature looks at the current Gramps Filter and scrapes the parameters to create a new Custom Filter.

Such a custom filter would have a lot of uses. Prime example: reports, tools, and exports may be quickly filtered to match contents of a view.

(This eases the convoluted and slow process of: filtering a view, create a new tag, select all the object in the view, apply the tag, create a custom filter on the tag, use the filter with the report, tool, or export. Then clean up the tag & tag filter.)

But in conjunction with the FilterParams tool, using a scraped filter also creates a more advanced version of the Filter Gramplet with additional limits for some of the Filter Gramplet fields. In a scraped People Filter Gramplet, the original Death parameter only accepts a Date. But in the scraped version, you can also look for the Death Place or part of a Description. And you can apply the Regular Expressions controls with more granularity.

 ![image](https://global.discourse-cdn.com/free1/uploads/gramps/original/2X/2/28538d199df19a058b082fed1dc8e813a5a9e88c.png) ![image](https://global.discourse-cdn.com/free1/uploads/gramps/original/2X/5/5db247f7b8da0c3e976703fc6ed2345bcb9fc99d.png)

**Now @kku is trying to determine whether this would be better as a part of SuperTool or as a separate Tool.** As it stands now, there aren’t any options that would require SuperTool’s flexible controls. It just pops a dialog for choosing a name for the script. Nor would you likely run it repeatedly in a short span. So that suggests becoming a separate Tool.

**But would there be use cases for this feature WITHIN SuperTool too?**

This feature parallels a much more simplistic (but GUI accessible) option in the Clipboard. (Although context menus are often overlooked to the point of becoming “easter eggs”.) The “[Create filter from the \<object type\> selected…](https://gramps-project.org/wiki/index.php/Gramps_5.1_Wiki_Manual_-_Navigation#Clipboard_context_menu)” context menu option allows a Custom Filter to be automatically generated for the selected object(s).  
 ![](https://global.discourse-cdn.com/free1/uploads/gramps/original/2X/f/f041c56841d9a9d91f13e23eca3702b480ae5f0c.png)

 ![image](https://global.discourse-cdn.com/free1/uploads/gramps/original/2X/0/08d08855f5c1646772fe8e311e9d23b23de67ec7.png)

Maybe it would be better to beta test the feature as a 5.1 Tool addon so that the bugs can be shaken out. Then the addon could be deprecated by rolling it into the core. Maybe as a new pop-up menu for the Filter Gramplets in 5.2? This would simplify contextual access and be consistent with existing GUI. Or, since a contextual menu with a single option is generally frowned upon, another button might be added beside the Find and Reset buttons at the bottom of the Filter Gramplets.
