Skip to Content
0
Jan 22, 2020 at 11:44 AM

FIORI OVP Custom Filter more than one value in one input

252 Views Last edit Jan 22, 2020 at 11:50 AM 2 rev

Hi all,

I have currently created a working global filter bar for my Overview page and i can filter with one value. Now I want to replace it and I created a multi input filter that will filter my data set with more than one value (CELL_14, CELL_15) etc

I adapted my global filter function (getCustomFilters) and created a for loop that will push the values of the multi input into the filter array

Two tokens in the multi input. 'CELL_14' and 'CELL_15'

custom.controller.js

getCustomFilters: function () {
	var that = this;
	oValue2 = that.oView.byId("WorkCenterInput").getTokens();
	var txtFilters = [];

	for (var i = 0; i < oValue2.length; i++) {
		txtFilters.push(oValue2[i].getText());
	}
	var aFilters = [],
		oFilter2;

	if (oValue2) {
		for (var i = 0; i < txtFilters.length; i++) {
			oFilter2 = new Filter({
				path: "CellName",
				operator: "EQ",
				value1: txtFilters[i]
			});
			aFilters.push(oFilter2);
		}
	}

	if (aFilters && aFilters.length > 0) {
		return (new Filter(aFilters, true));
	}
}

However, the filter will only work if there is one token in the multi input. It will not work if I have more than one (value) token in the multi input.

Is there any way to fix this issue in my custom filter function, I tried manually inserting two sets of filters in a testing project with these filters and it worked so I assume it's an issue with my code.

Thank you in advance.

Attachments

filterbar.png (5.5 kB)