Sunny the solution which i have provided above is working but the label is showing a variable name not the selected field name. But i want to try your GetFieldSelections() option too.. for example in the script i have defined the inline table as below:
Load * Inline [
when i take the _PrimaryDimension in the filter pane. And now i want the same field to be displayed in the chart too..Let me know if that makes sense. otherwise i will post you in some more detail.
One of my colleague helped me on this. Wanted to post because there could be people like me...
Modify your script like this:
Define a table with the field names that you wish to select for your chart (it can be an inline table or any other type of table.)
Set HidePrefix accordingly
Create a variable to hold the Current Primary Dimension. (It will only have a value if a value is selected.)
SET HidePrefix='_' ;
Load * Inline [
LET vCurrentPrimaryDimension = '=$(GetCurrentField(_PrimaryDimension))';
Modify your GUI like this:
Add a listbox
Set the Field function as:
Title value as:
Add a Chart:
Define the Dimension of your Chart to be:
(leave it blank) Unfortunately, the label does not allow a function, so it cannot be variable
Set the Title of your chart to be:
(Optional) And the Footnote of your chart to be:
And i don't the answer whether we can hide and enable a chart.
one thing you wont have with this approach is "Always One selected" if user doesnt pick anything you will error in the chart.
i am using an list box extension for my on the fly metrics/dimension selections.