Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Highlighted
gfisch13
Contributor

Pick or Match using a Variable

Hi All, hoping someone could help me with a problem I've been having.

1) I have and inline table that I've created from a list of keywords (below), I'm loading this from my script.   

2) I've created a variable called vKeyword that uses the GetFieldSelections function to store all my selections.  (I'm not certain that this is the correct use of the function).

3) I want to match the values that are stored in vKeyword in my main table to a field called ITEM_DSCR.   The variable can store one or multiple items.

4)  I've gone into document settings and created actions for the ITEM_DSCR field but when I make a selection nothing is happening.  

When I make a selection I'd like to see all occurences of my keyword selections in my ITEM_DSCR list box and in turn I would expect the rest of my charts to change dynamically.

I'm sorry for the lengthy entry, just trying to give enough detail.   Really would appreciate some help on this. 

Thanks in Advance!

George

 

 

Keywords:
LOAD * INLINE [
KEYWORD
TICKETS
IPOD
IPAD
CAMERA
APPLE
IWATCH
TV
FEE
CONSULT
MISC
SERVICE
RENDER
LIAISON
TIP
PROCES
FACIL
EXPED
CASH
];

1 Solution

Accepted Solutions
chrismarlow
Valued Contributor

Re: Pick or Match using a Variable

Ahhhh.

So you want to do a wildmatch from a column with a list of key words into another column where these words are parts of strings?

So going back to your actions try;

='(*'&GetFieldSelections(KEYWORD,'*|*')&'*)'

As your search string on ITEM_DSCR select in field triggered by KEYWORD on select  action;

20190409_3.png

Let me know if that is better (or worse :))

Cheers,

Chris.

 

6 Replies
chrismarlow
Valued Contributor

Re: Pick or Match using a Variable

Hi,

If what you want is a cut down list of the possible ITEM_DESC values in a different field called KEYWORD then I would try a different approach. So you could either join your keyword table to your data table, or create an association, which my toy script does;

Keywords:
Load
	*,
	KEYWORD AS ITEM_DESC;
LOAD * INLINE [
	KEYWORD
	TICKETS
	IPOD
];

data:
LOAD * INLINE [
	ITEM_DESC, VALUE
	TICKETS, 10
	IPOD, 5
	PHONE, 7
];

So with no selections 'PHONE' is not in the keyword list;

20190409_1.png

But a normal selection reduces the data as expected;

20190409_2.png

Hope that helps.

Cheers,

Chris.

gfisch13
Contributor

Re: Pick or Match using a Variable

Hi Chris - I appreciate the feedback.  Please see my picture attached, as that depicts a clearer statement on what I'm trying to do.   I really don't want to remove any values, I just want what I select to return all the values in the ITEM_DSCR field and change my charts upon selection.    Hopefully this clarifies, I'm a really junior user of the product so I'm sorry if this sounds simplistic.

Thanks!

chrismarlow
Valued Contributor

Re: Pick or Match using a Variable

Ahhhh.

So you want to do a wildmatch from a column with a list of key words into another column where these words are parts of strings?

So going back to your actions try;

='(*'&GetFieldSelections(KEYWORD,'*|*')&'*)'

As your search string on ITEM_DSCR select in field triggered by KEYWORD on select  action;

20190409_3.png

Let me know if that is better (or worse :))

Cheers,

Chris.

 

gfisch13
Contributor

Re: Pick or Match using a Variable

PERFECT!!!!!   Exactly what I was looking for.   Thanks for removing about 1000 pounds of stress.

Can you explain the function a bit so I can learn the components??

chrismarlow
Valued Contributor

Re: Pick or Match using a Variable

Hi,

Glad it helped.

The function in total is coming up with a string that would actually work as a search string if you typed it in.

So the ( and ) at the start and end let the middle be structured as a pipe delimited list (pipe being OR). To get the pipes and use as wild cards need to add * inbetween the brackets and then get a list delimited by *|*.

Therefore the parameters of the Get function are the field and the delimiter. 

Not sure if above helps or is just more confusing...

Cheers,

Chris.

 

 

 

gfisch13
Contributor

Re: Pick or Match using a Variable

Chris - thanks again for the explanation it was perfect and easy to understand.  I was also able to explain to a coworker so that's a win win!!!!