How to use Custom Interactive Filter?

Today, I recognise that custom interactive filter can actually be very powerful. here is why.

I wanted to create a dashboard that contains 2 reports, the first report should show incidents grouped by Category and the second one should show incidents grouped by CI – so far all well & easy and no need for custom interactive filter.

I wanted also to enable my end users to filter on short description, in other words, I would like them to be able to interactively use Short Description CONTAINS filter on my dashboard.

The standard interactive couldn’t allow me to do that hence I created a custom interactive filter. The filter should take end user input and then search on Short description.

below is Dynamic Content block which i used as Custom Interactive filter

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
 <script>
     var my_dashboardMessageHandler = new DashboardMessageHandler("incident_dashboard");
  
    function searchbyShortDesc (str) {

        var filter_message = {};
        filter_message.id = "incident_dashboard";
        filter_message.table = "incident";
    
    <!--     Add your own filter query logic here -->

        filter_message.filter = "short_descriptionLIKE" + str;
        SNC.canvas.interactiveFilters.setDefaultValue({
                id: filter_message.id,
                filters: [filter_message]
            }, false);
        my_dashboardMessageHandler.publishFilter(filter_message.table, filter_message.filter);
    }
    

 </script>   
 
<input id='interactive' type='text' value='' onChange='searchbyShortDesc(this.value);'/>

</j:jelly>

2 thoughts on “How to use Custom Interactive Filter?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s