Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Read about the latest Qlik Community enhancements on the Community News blog!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

dynamically changing dimension based on selection

how can one create a dimension based on the field [DIFF.123] where one creates that field based on user selections (string concat)?

Or the user selects the field from a $Field listbox and the dimension of a chart is tied to that selection?

1 Solution

Accepted Solutions
Gysbert_Wassenaar

You can create a table with the field names with something like this:

// For all tables, get field names, put them in table called f_names, field called FName
for ii=1 to NoOfTables()-1  // -1 here because otherwise f_names table itself is included
  for jj=1 to NoOfFields(TableName($(ii)) )
       f_names:
      
LOAD FieldName($(jj),TableName($(ii))) as FName
      
Autogenerate 1;
  
next
next

If you only want FName values starting with DIFF you can put an if statement in the above code, or use the table to create a new one with only the FName values you want, or create a listbox and restrict the values in the listbox with an if statement.


talk is cheap, supply exceeds demand

View solution in original post

4 Replies
Gysbert_Wassenaar

Is this what you're looking for? -> Customizable Straight Table


talk is cheap, supply exceeds demand
Not applicable
Author

It's close and I've implemented tables like that in the past.  My problem is that I won't know ahead of time the names of the possible fields.  Just every field loaded like 'DIFF.*'; so I can't precreate the dimensions and expressions in the chart.  My specific case is that I want to set the dimension equal to something like [$(getfieldselections($Field))]; however, when I do this, I get an internal consistency error and QV crashes.

Gysbert_Wassenaar

You can create a table with the field names with something like this:

// For all tables, get field names, put them in table called f_names, field called FName
for ii=1 to NoOfTables()-1  // -1 here because otherwise f_names table itself is included
  for jj=1 to NoOfFields(TableName($(ii)) )
       f_names:
      
LOAD FieldName($(jj),TableName($(ii))) as FName
      
Autogenerate 1;
  
next
next

If you only want FName values starting with DIFF you can put an if statement in the above code, or use the table to create a new one with only the FName values you want, or create a listbox and restrict the values in the listbox with an if statement.


talk is cheap, supply exceeds demand

View solution in original post

Not applicable
Author

Okay, so create an island is what it seems you are suggesting.  I can easily do that, thx.