Well, it's working in the sense that it's returning a value of zero. So one of two things is happening, either this isn't valid: Sales::Current Sort="Year", or your chart object needs to be refreshed because it's returning zero before sort is set to "year".
You can add a refresh window script step to the end of the script that sets sort to "year" and see if that updates it.
I added refresh window to the script, and I also tried a refresh object, but neither made a difference :/
I imagine if there's a way to set chart label in a script that'd help make sure it's all happening in the proper order too
If your chart labels are calculated from global variables (EG $$label1, $$label2, etc..), then you could change them via script.
I changed the script to set variable
Set Variable [$$current_sort ; Value:Sales::Year]
and then changed my chart label to $$current_sort
but it only returns one value (eg 2015) instead of all the values
I can get the labels to switch given the sort now, but again, only returning one value instead of all values
otherwise you're only pulling a single record's value instead of a found set.
Set Variable [$$current_sort ; Value:List(Sales::Year)
but now it returns 2014 for all labels instead of 2015??
You'll need to come up with a calculation that works to return the value in a format you need.
Without a demo file to play around with or screenshots, it's getting hard to continue to offer suggestions.
I figured it out.
After many attempts and trying a number of functions to list values... it ended up working by setting the chart label calculation to Case ( Sales::Current Sort="Year" ; Sales::Year ; Sales::Current Sort="Payment Method" ; Sales::Payment Method ; Sales::Current Sort="Sale Portal" ; Sales::Sale Portal ; Sales::Current Sort="Primary Income Type" ; Sales::Primary Income Type ; 0 )
no variable needed
thanks for helping me get the creative juices flowing!