Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
Not applicable

Filter table based on other Table

Table1

IDDate1Date2
ID101/01/201402/02/2014
ID203/03/201404/04/2014

Table2

IDTypeActivityDate1
ID1AA01/02/2015
ID1BA01/03/2015
ID2BB20/02/2015

TableConsolidated:

IDDateFrom
ID101/01/2014Table1
ID102/02/2014Table1
ID203/03/2014Table1
ID204/04/2014Table1
ID101/02/2015Table2
ID101/03/2015Table2
ID220/02/2015Table2

Hi, i am working on a report like the example above, where i have two tables in different formats which consolidated in tableConsolidated. Now i want to filter the TableConsolidated based on the fields from Table2, using the fields Type, Activity or any other field from this table. I Assume that since i link the 2 tables based on the field ID i could do this, but when i try to filter the field 'Type' selecting 'A', the TableConsolidated shows the result below:

DDateFrom
ID101/01/2014Table1
ID102/02/2014Table1
ID101/02/2015Table2
ID101/03/2015Table2

What i expect was only the dates that has an "A" in the "'Type" field. What kind of link do i have to do? In my complete table i have more than 20 field from table2 that i wish to filter in TableConsolidated

Tags (1)
10 Replies
ramoncova06
Valued Contributor III

Re: Filter table based on other Table

we would have to see the data in order to be able to provide more details as what might be the issue

MVP
MVP

Re: Filter table based on other Table

Do you want to do this in a Load Script or in the running application?

Not applicable

Re: Filter table based on other Table

In the Load Scrip

MVP
MVP

Re: Filter table based on other Table

How do you do your filter now in the load script? While the load script is running there is no links between any tables. It is when the load script is about to finish that QlikView goes through it's association procedure and establish the resulting data model for the running application and/or the finally saved and reloaded QVW-file.

Not applicable

Re: Filter table based on other Table

Hi Petter, Follow attached part of my report. Table SITES is my Table1, REWORK my Table2 and DATAS my TableConsolidated. I created a filter "ReworkActivity" which is my "Type" from Table2. And [%Key field] is my ID. In The Graph i have two activities that can be filtered in Rework Activity selecting SI or WR. As you can see, if you filter the tables, the graph shows the right result, but if you filter the field "ReworkActivitY", for example "SI", it does not shows only the results for SI in Table2, it shows the result for every ID ([%Key field]).

Obs. You will not be able to reload because it access an intranet SharePoint.

Not applicable

Re: Filter table based on other Table

Hi Ramon, I responded to Pettor below with my database. BR

MVP
MVP

Re: Filter table based on other Table

Well if you want the graph to only show activities for ReworkActivity that happens for DATASTypeField = Table 2 without specifically selecting Table 2 in the Tables list box you could simply put in a Set Expression in your Sum() expression in the chart (graph):

        If( WildMatch( DATASType , 'Production*' ) , Sum( { < DATASTypeField = { 'Table 2' } > } DATASCount ) )

Then this graph will always just show activities for this specific DATASTypeField...

Not applicable

Re: Filter table based on other Table

In fact i want to select for example "SI" in ReworkActivity from table2, and it filter in table consolidated only the values that has SI atribute. In this case, show only "0.1.8 SI Rework" and exclude "1.1.8 WR Rework" from the graph.

MVP
MVP

Re: Filter table based on other Table

Then I would go for this:

Sum( {<DATASTypeField={'Table 2'},DATASType={'Production*'},StepAtividade={'*SI*'}>} DATASCount)

Sorry - I am not fully into what you are trying to achieve - but this expression will make the graph only show "0.1.8 SI Rework" ... is this want you want then?

Community Browser