Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
sban
Contributor III
Contributor III

Automatic Double Filter Selection

Hi,

I have a column in my table with ID values like a1-b2/b2-a1/c1-c9/c9-c2/c9-c1 and so on.

Is there any way I can write a set expression in the filter, such that if the user selects a1-b2, both a1-b2 and b2-a1 should get selected ?  Similarly if user selects c1-c9 both, c1-c9 and c9-c1 should be selected.

Alternatively, if possible I don't mind making changes in the data load editor such that rows with a1-b2 and b2-a1 in this ID column, and similarly for other row combinations, can be assigned a unique ID respectively for each group of rows, such that only this ID can be then called through the filter.

Any help would be appreciated!

Thanks and Regards!

1 Solution

Accepted Solutions
chrismarlow
Specialist II
Specialist II

Hi,

Maybe;

data:
Load
	if(left(ID,LChar)<right(ID,RChar), ID, right(ID,RChar)&'-'&left(ID,LChar)) AS NewID,
	*;
Load
	FindOneOf(ID,'-')-1 as LChar,
	Len(ID)-FindOneOf(ID,'-') as RChar,
	*
	;
Load * inline [
ID,
a1a-b2,
b2-a1a,
c1-c9,
c9-c2,
c9-c1
];

Cheers,

Chris.

View solution in original post

4 Replies
chrismarlow
Specialist II
Specialist II

Hi,

So it may well be possible to write set analysis, but suspect it might get messy for multiple selections, as you can change your script I would use a preceding load, similar to this;

data:
Load
	if(left(ID,2)<right(ID,2), ID, right(ID,2)&'-'&left(ID,2)) AS NewID,
	*;
Load * inline [
ID,
a1-b2,
b2-a1,
c1-c9,
c9-c2,
c9-c1
];

Cheers.

Chris.

sban
Contributor III
Contributor III
Author

Hi @chrismarlow , Thank you for your reply! I actually have a1-b2,b2-a1 as an example, however what I meant to explain by this example was, the reversal of values before and after the '-'. Actually, I do even have some strings containing both numbers and letters, so the '<' may not work, if I understand correctly. 

Could you please suggest how I could do the script load in this case?

Thanks and Regards.

chrismarlow
Specialist II
Specialist II

Hi,

Maybe;

data:
Load
	if(left(ID,LChar)<right(ID,RChar), ID, right(ID,RChar)&'-'&left(ID,LChar)) AS NewID,
	*;
Load
	FindOneOf(ID,'-')-1 as LChar,
	Len(ID)-FindOneOf(ID,'-') as RChar,
	*
	;
Load * inline [
ID,
a1a-b2,
b2-a1a,
c1-c9,
c9-c2,
c9-c1
];

Cheers,

Chris.

sban
Contributor III
Contributor III
Author

Thank you @chrismarlow , this helped !