Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Both dynamic dimensions AND expressions

Hi,

I want to make a chart where the user is able to select dimensions and expressions dynamically.

I have a listbox in which the available tables are shown ($table).

I then created a listbox which shows the available fields in that specific table ($field). This listbox should be used as the source for the dimensions, so in a chart I would get the dimension by getFieldSelection($Field).

My question is: How can I make a listbox from which the user can select the fields for the aggregation in the chart?

I can't create another listbox with $Field because it would only show the selected dimensions.

My first approach was to load the $Field list into a variable, but unfortunately i don't know how.

Any help would be appreciated!

4 Replies
marcus_sommer

With QV 11 you could see an example in the demo "Whats New in QlikView11.qvw" (in your install-folder) in tab "Reports" how in worked.

- Marcus

Not applicable
Author

Hey Marcus,

thanks for your reply. In this .qvw the metrics and dimensions are predefined in the load script. I would like that the user can chose out of all available fields in the table without limiting them or having to know which fields are metrics or dimensions in the load process. There will be a number of tables that the user can choose from, this is why I want to keep completely dynamic.

sparur
Specialist II
Specialist II

Hi

I think you could autogenerate a list of fields in the script. Dimension List and Metrics list.

Or maybe try to use a system field $Field, but I'm not sure, that it will work.

marcus_sommer

For a script list from all fields you could use a loop like this:

for i = 0 to NoOfTables() - 1

    for ii = 1 to NoOfFields(TableName($(i)))

        let vTableName = '[' & TableName($(i)) & ']';

        let vFieldName = '[' & FieldName($(ii), TableName($(i))) & ']';

        DataStructure:

        Load

            $(i) as TableNumber,

            TableName($(i)) as TableName,

            NoOfRows(TableName($(i))) as Rows,

            $(ii) as FieldNumber,

            FieldName($(ii), TableName($(i))) as FieldName

        Resident $(vTableName) Where '$(vTableName)' <> 'DataStructure';

        let vFieldCounter = 0;

    next

next

Have you a prefix for numeric fields like # you could this to differentiate in this loop too else you will be the possible expressions anywhere defined, perhaps as Inline-Table.

- Marcus