Data Input - Refresh Visualization

Hi,

I have a dashboard where users can make a data input from a drop down list - selecting the last action completed for a patient.

Users want to be able to filter the data and complete the data input on the filtered list. The issue I’m running into is after the data input button is clicked the refresh visualization will revert the user back out to the default dashboard view instead of their filtered list. One option would be to leave the refresh visualization unchecked but then the users wouldn’t see the real time data input change.

I’d imagine I might be able to workaround this with a script that reverts them back to their filtered view. Does anyone have any suggestions?

Thanks for your help.

What do you mean ‘filtered view’?
As far as I know, if the user has set a parameter via a filter component (hierarchy picker or similar), the visualization should refresh with that filter applied. If it doesn’t, I reckon that’s a bug.

What about leaving the refresh option unchecked, but putting a script of ‘loadData()’ for the visualisation that you run in the on click of the data input button. Does that work?

If not, then you should be able to have a script to keep track of the filter selections and reapply them, but that would mean the visualisation loading with the unfiltered view and then changing.

David thanks so much for getting back to me.

The user is selecting a specific doctor from a value filter and making the data input for the patients under that specific doctor but when they click the data input button the refresh visualization takes them back to showing all doctors.

I will have to try what you mentioned regarding the loadData() script.

The visualization is currently loading with an unfiltered view.

Thanks again

Hi Derek,

If there are values that need to be taken into account when refreshing you can set hidden values with the values selected and the data input and set them on the OnClick().
For having a filter value set to the very same value when reloading you need to have a hidden filter linked to the same hierarchy, and just copy the value of the ViewParameters in the Click event of the button, and then call the OnLoad(), something like this:

// Identify the view parameters
var vp1 = this.parentView.control.getViewParameterByName(“MyListFilterViewParameter”);
var vp2 = this.parentView.control.getViewParameterByName(“MyHiddenListFilterViewParameter”);
// Remove all values and tokens from the hidden parameter value
vp2.parameterValue.clearTokens();
vp2.parameterValue.clearValues();
// Set Filter #2 to have the same values as Filter #1
vp2.parameterValue.values = vp1.parameterValue.values;
// Set the last modified time so this parameter takes precedence over any others
vp2.invalidateParameterValueLastModifiedTime();
// Update all the connected adapters with the newly modified values
// Includes data visualizations and filter controls
vp2.refreshAllAdapters();

hiddenParameterTextBox2.control.value = parameterTextBox1.control.value; // where parameterTextBox1 is the one set by your end-user (if it’s a string, but it works the same for a number, the only thing is that both filters have to have the same format)
// Then launch the OnLoad()
myTable.loadData();

And in the OnLoad() of MyTable, you just do the reverse, copy vp2 value to vp1, and copy hiddenParameterTextBox2 value to parameterTextBox1, then just refresh the adapters.
By the way you’ll have to deal with null values at least for the first time the OnLoad() is called (which can be solved by a if-else…).
I hope this helps,
Olivier

When I write hidden understand out of the view, not set as Hidden. :upside_down_face:

1 Like

Hi Olivier,

Thank you so much for your response I will definitely use this in the future when needed.

Embarrassingly enough I made a mistake which was causing this whole issue. I copy and pasted a button which already had a refresh visualizations script on it and I didn’t even notice. As soon as I removed that script everything behaved as expected.

I appreciate everyone getting back to me even though I was at fault here.

2 Likes

Easily done. Most annoyingly, computers do what you say, not what you mean.

1 Like

Blame Alexa, then :laughing:

1 Like