Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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
Author

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.