Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Highlighted
anothergreg
New Contributor III

Button to filter a table box

I'm attempting to create two buttons that will filter a table box using some pre-set and non-changing criteria.  Column A needs to filter out blanks.  Column B needs to filter out blanks and string criteria ( left(fieldB,4)=http and right(fieldB,3=xml) ).  Column C is a rollup that will not be filtered.  There is value in being able to mix/match filters, so I cannot just output the table box with all filterable criteria applied, thus  I'm attempting buttons.

I was able to get the button to work for Column A.  Solution was:

Action 1) Select in Field for fieldA, search string =if(len(trim(fieldA))=0,'').

Action 2) Select Excluded fieldA.

Works without issue.

However, I'm having a heck of a time attempting to get the fieldB filter to work.  I can't select the field using logic that contains the field, and thus I'm stuck.

Ideally, I'd like to do something similar to (forgive me if syntax is not correct, but I've tried doing them individually and it doesn't work anyway, so I never focused on getting the syntax to work for both together):

Select in Field for fieldB, search string ='=if(left(trim(fieldB),4)="http",if(right(trim(fieldB),3)="xml",fieldB or =if(len(trim(fieldB))=0,"")'

Focusing on the portion which I know isn't working, =if(left(trim(fieldB),4)='http',if(right(trim(fieldB),3)='xml',fieldB)), is there any way to get a button to simple filter on certain criteria like this?  It seems like a simple concept, but I can't imagine how it would be possible.  I've googled a bunch of Qlik community posts but haven't found anything similar.  I'm very, very new to Qlikview, so hopefully I'm not wasting space on the board by posting something obvious.

Thanks in advance,

Greg

1 Solution

Accepted Solutions
MVP & Luminary
MVP & Luminary

Re: Button to filter a table box

Hi Greg,

Table boxes are never particularly useful things, as you can't have expressions.

You may have more joy with a Chart of type Straight Table.  You can then write an expression to decide which rows to show.  The buttons just need to flip variables that you then use in your expression.  The column that decides what should be shown can then be hidden in the properties on the Presentation tab.

You will also find things easier if you create flags in the load script.  So, derive a simple flag field (0/1) in the load with field names like IncludeFieldA and IncludeFieldB.  The expression needed on the table then becomes very simple.

I hope that makes sense.  Please let me know if you want me to elaborate.

Steve

5 Replies
krishna_2644
Valued Contributor III

Re: Button to filter a table box

provide a demo app,please.

MVP & Luminary
MVP & Luminary

Re: Button to filter a table box

Hi Greg,

Table boxes are never particularly useful things, as you can't have expressions.

You may have more joy with a Chart of type Straight Table.  You can then write an expression to decide which rows to show.  The buttons just need to flip variables that you then use in your expression.  The column that decides what should be shown can then be hidden in the properties on the Presentation tab.

You will also find things easier if you create flags in the load script.  So, derive a simple flag field (0/1) in the load with field names like IncludeFieldA and IncludeFieldB.  The expression needed on the table then becomes very simple.

I hope that makes sense.  Please let me know if you want me to elaborate.

Steve

Re: Button to filter a table box

Hi,

May be try this in search string for your fieldB

Like

('http*'|'*xml')

MVP & Luminary
MVP & Luminary

Re: Button to filter a table box

I assume that you mean NULL if you talked about "blanks". Then you could use an inbuilt feature by tableboxes to hide them - go to the tab presentation and below the dimension-list in the top-left you could enable this hiding for each dimension separately.

Your second criteria should be covered with wildmatch(fieldB, 'http*xml') and I suggest rather not to use buttons for this (in general they should be avoided unless there is really no other (practically) way to select the data) and would use a bookmark.

Further possible ist to create flag-fields and/or categorizing fields within the script to simplify data-selections and calculations - it makes not much sense if this is your only condition on fieldB but if there are more ...

- Marcus

anothergreg
New Contributor III

Re: Button to filter a table box

This helps a lot.  I read about using variables for tasks like this, but this clarifies things.  I think the Straight Table chart will work with the variable combination.