Search code examples
qlikview

Allow user input of chart axis in QlikView


I'm creating a scatter chart in QlikView. I'd like the field used for the y-axis of the chart to be user selectable. For example, I create a scatter plot, and choose my x-axis as "field1" and y-axis as "field2".The actual expression in QlikView for the y-axis is SUM([field2]). This works fine to plot field1 vs. field 2.

Now, I have a list box for the user to select a field (using $Field). I can get the name of that field using GetFieldSelections($Field). That works fine as an expression for the label, but it doesn't work as an expression to replace the equivalent of SUM([field2]). How do I set my expression so that if the user chose "field2" in the listbox, I get the same result as my hard-coded "field2" expression? I tried Sum(GetFieldSelections($Field)) and that doesn't work at all. I'm guessing I need some other function which returns the field values for an input string of a field name, but I don't know what that is.

Thanks!


Solution

  • You could try this syntax :

     Sum ($(=GetFieldSelections($Field)))
    

    I've build a small example and it seem to work.