Filter cannot be removed


#1

Hi all, first question around. I’ve been looking for the issue but no one has posted about it before. Here is my situation:

I recently received a Studio dashboard (a .cfs file) with some settings configured (filters, metadata, etc). When I imported the dashboard, I deleted all filters by clicking “Remove All” in the Interaction Manager widget. When all filters were deleted, I reloaded the dashboard but a filter (that I was sure I deleted) reappeared. I deleted the filter again to noticed that after a second reload the filter was still there.

Is this a normal behaviour or maybe the cfs file has some configurations to avoid this that needs to be changed?


#2

Hello and welcome to the CF community @stark.

I don’t quite understand the situation. Is this filter reappearing in the Interaction Manager UI or are you referring maybe to a filter in the widgets code? In this last case could be a static filter which is not handled by the Interaction Manager.


#3

Hi @eduardo

Yes, the filter is reappearing in the Interaction Manager even if it is deleted. I guess is not a static filter but not quite sure. Here is an example:

/* Configuration code for this widget */
let provider = cf.provider("ES Local");
let source = provider.source('women_in_congress');
//<start filter222> Autogenerated Filter   
let filter222= cf.Filter('@timestamp')
			.label('@timestamp')
			.value('Last 3 years')
			.isRelative()
//<end filter222>
// Define metrics
let metric0 = cf.Metric("members", "sum");
// Define attributes to group by
let group1 = cf.Attribute("chamber")
	.limit(10)
	.sort("desc", cf.Metric("members", "sum"));
// Add metrics and groups to data source
let myData = source.groupby(group1)
	.metrics(metric0);
// --- Define chart options and static filters ---
// Define Grid
let grid = cf.Grid()
	.top(10)
	.right(15)
	.bottom(35)
	.left(65);
// Define Color Palette
let color = cf.Color()
	.palette(["#0095b7", "#a0b774", "#f4c658",
		"#fe8b3e", "#cf2f23", "#756c56",
		"#007896", "#47a694", "#f9a94b",
		"#ff6b30", "#e94d29", "#005b76"]);
//<start exec filter222> Autogenerated Filter   
myData.filter(filter222);
//<end exec filter222>
let myChart = myData.graph("Bars")
	.set("grid", grid)
	.set("color", color)
	.set("dataZoom", false)
	.execute();

I guess is not static cause of the autogenerated in the comment, but again not sure.


#4

I see a relative filter there, which is usually applied by the Time Slider. Can you confirm you are using this visualization? Is it possible for you to take a screenshot or show here the code (preferably) in case you are using the widget?


#5

Yes, the Time Slider is used. Here is the code:

/* Configuration code for this widget */
let provider = cf.provider("ES Local");
let source = provider.source('women_in_congress');
//<start filter300> Autogenerated Filter   
let filter300= cf.Filter('@timestamp')
			.label('@timestamp')
			.value('Last 3 years')
			.isRelative()
//<end filter300>
let grid = cf.Grid().right(20).left(10);
// Define the time field to be used
let field = cf.Attribute("@timestamp").func("DAY")
// Add field to data source.
// Add metrics and groups to data source
let myData = source.timeField(field)
// --- Define chart options and static filters ---
//<start exec filter300> Autogenerated Filter   
myData.clientFilter(filter300);
//<end exec filter300>
let myChart = myData.graph("Time Slider")
			.set("grid", grid)
			.set("player", {
					"enable": true,
					'pin-left': false,
					'step': 1,
					'step-unit': 'year',
					'refresh': 1,
					'animation-delay': 0.4,
					'live': false,
					'autoplay': false,
                   'preset': 'last-3-years',
			})
			.execute();

And here is the widget:


#6

I see now, The problem is that you are removing the filter from the Interaction Manager BUT NOT the preset you are using in the Time Slider. So when the dashboard is reloaded the preset will be applied as a filter again.

After removing the filter, click on the preset name in the Time Slider (the label in the middle) and then click “Clear”. That will remove the preset so it won’t be fired on reload anymore.


#7

Oh my, that was driving me crazy! Thanks. Yes, that did the trick. I’m relatively new to this so I didn’t notice the preset. Thanks again