Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Support Case Portal has moved to Qlik Community! Read the FAQs to start exploring Support resources.
Showing results for 
Search instead for 
Did you mean: 
Creator III
Creator III

Reference which table a field is in?

I have a requirement whereby if a selection is made within the fields of a specific table in the QV Data Model, one expression is used, else another expression is used.

I could do something like this: if(getselectedcount(salesrep)>0,sum(detail),sum(summary))

But the problem is I have a few dozen fields that must use an alternative expression with this same logic.

I do not want to have to list these fields out within nested if statement or whatever, because that will require maintenance.  Is there a way to reference all the fields in a particular table in the data model so if(getselectedcount(all fields in customer table)>0,sum(detail),sum(summary)) that would be way better.

Is this even possible?

1 Reply
Not applicable

Hi Aaron,

  Can be done using variables. You will need to reference system fields. Your expression will look like

if($Table = 'customer_table',sum(detail),sum(summary)).

$Table is a system field that contains a list of tables. Making a selection on any of the fields within it will internally select this table.