cancel
Showing results for 
Search instead for 
Did you mean: 

Can I remove a predefined filter in Sisense

Astroraf
10 - ETL
10 - ETL

Am I able to remove a predefined filter within Sisense that would disallow my viewers from choosing this option? I am using a date filter and the options in the date filter are Last, This, and Next. I want to be able to remove the Last but keep the This and Next filters as options for my viewers. 

 

@DRay  @intapiuser 

1 ACCEPTED SOLUTION

rapidbisupport
11 - Data Pipeline
11 - Data Pipeline

Hi @Astroraf ,

Can you try the following?


        prism.on('dashboardloaded', (args, dash) => {
			const elem = document.createElement('style')
        	elem.innerText = `.gsoNqAmwurDnBIjywenH:nth-child(1) { display: none; }`
            document.head.appendChild(elem)

        })

This removes the 'Last' item by hiding the associated container in CSS.

It works on my side L2024.1 - but would be mindful to check if any changes to the class name in future (should include in any future version upgrade regression testing in case you need to change the reference).

Result:

rapidbisupport_0-1723424609057.png

Thanks,

Daniel

RAPID BI

[email protected]

RAPID BI - Sisense Professional Services | Implementations | Custom Add-ons

 

View solution in original post

7 REPLIES 7

HamzaJ
12 - Data Integration
12 - Data Integration

Hey @Astroraf ,

I dont think this is possible. However you could use Blox to create buttons that do exactly this. You can then lock that filter so users cannot change it, except for with the predefined filters in the Blox buttons. --> https://community.sisense.com/t5/knowledge/blox-filter-buttons-for-trailing-x-months/ta-p/8649

Here is a link to a post explaining this. If you are looking for a easier way then I can recommend @Ravid_PaldiTeam 's date range filter https://www.paldi.solutions/plugins/date-range-filter

Hamza

rapidbisupport
11 - Data Pipeline
11 - Data Pipeline

Hi @Astroraf ,

Can you try the following?


        prism.on('dashboardloaded', (args, dash) => {
			const elem = document.createElement('style')
        	elem.innerText = `.gsoNqAmwurDnBIjywenH:nth-child(1) { display: none; }`
            document.head.appendChild(elem)

        })

This removes the 'Last' item by hiding the associated container in CSS.

It works on my side L2024.1 - but would be mindful to check if any changes to the class name in future (should include in any future version upgrade regression testing in case you need to change the reference).

Result:

rapidbisupport_0-1723424609057.png

Thanks,

Daniel

RAPID BI

[email protected]

RAPID BI - Sisense Professional Services | Implementations | Custom Add-ons

 

@rapidbisupport the reason I ask, is that my client is asking about how to remove the bottom three filter options to present to their clients. 

Astroraf
10 - ETL
10 - ETL

@rapidbisupport Thank you so much for the answer. Can you explain what the code is doing for some of us who aren't as tech-savvy with CSS?

Sure thing @Astroraf ,

Please see comments below:

// when a dashboard is loaded in the application (prism is Sisense application, and dashboardloaded is the event we are hooking into)
        prism.on('dashboardloaded', (args, dash) => {
// let's create a 'style' object - the kind that normally lives in the head of a document like <style> STYLE GOES HERE </style>
			const elem = document.createElement('style')
// The contents of the style uses a selector asking for the first child of the 'gsoNqAmwurDnBIjywenH' class, we want to set it's display property to none.
        	elem.innerText = `.gsoNqAmwurDnBIjywenH:nth-child(1) { display: none; }`
// we then append the style object we created to the head in the document
            document.head.appendChild(elem)

        })

 you can see these elements in the inspection panel in your browser:

rapidbisupport_0-1723503961492.png

This will give you an idea of the classes, ids, elements you can play with.

The other approach here is to use jQuery to manipulate the elements - but there are drawbacks here like that the element needs to exist when the jQuery runs.

You can try this in your console by doing this:

$('..gsoNqAmwurDnBIjywenH:nth-child(1)').hide()

If you run this in your browser console with the Last / This / Next selection open it will hide the Last option.

Hope this helps?

Thanks,

Daniel

RAPID BI

[email protected]

RAPID BI - Sisense Professional Services | Implementations | Custom Add-ons

So now I would like to remove these three filters. Utilizing your code would my code snippet be:

  prism.on('dashboardloaded', (args, dash) => {
			const elem = document.createElement('style')
        	elem.innerText = `.gsoNqAmwurDnBIjywenH:nth-child(1) { display: none; }`
            document.head.appendChild(elem),
                    const elem = document.createElement('style')
        	elem.innerText = `.HaPIPCLdFZZA6Wn8q1V:nth-child(3) { display: none; }`
            document.head.appendChild(elem)



        })

or since this element is of a div class then how would I change the code to reflect this?

 

 

PHOTO-2024-08-13-18-25-47.jpgPHOTO-2024-08-13-18-20-51.jpg

rapidbisupport
11 - Data Pipeline
11 - Data Pipeline

Hi @Astroraf ,

HaPIPCLdFZZA6Wn8q1VU looks like the class for the divs that contain these controls.

prism.on('dashboardloaded', (args, dash) => {
	const elem = document.createElement('style')
	elem.innerText = `
	.gsoNqAmwurDnBIjywenH:nth-child(1) { 
		display: none; 
	}
	.HaPIPCLdFZZA6Wn8q1VU:nth-child(3) {
		display: none;
	}
	.HaPIPCLdFZZA6Wn8q1VU:nth-child(4) {
		display: none;
	}
	`
	document.head.appendChild(elem)
})

Try this one out and let me know how you go?

Daniel

RAPID BI

[email protected]

RAPID BI - Sisense Professional Services | Implementations | Custom Add-ons