Shirly Soloman Posted June 8, 2023 Share Posted June 8, 2023 I have created a dropdown filter using expressions and it has 3 filter options : - 30 Days , 6 Months , 12 Months.Everytime I open my dashboard or change the page, the filter is changed to " --- ".Please suggest a solution to fix the filter to 6 Months, every time I revisit the page or open my dashboard. Link to comment Share on other sites More sharing options...
Jose Leviaguirre Posted June 8, 2023 Share Posted June 8, 2023 Hello ShirlyThe dropdown is a way to control a document property. If the document property changes in any way, it will reflect that in your dropdown. If the document property does not match any of the dropdown options, the dropdown will display as "---"If you have multiple pages using the same document property or a script that changes the document property for something else, for example, you have one page with a dropdown with options 3,6,9 and another page you have a dropdown with options 1,6 and 12, you will see "---" on page 1 if page 2 has 1 or 12 selected.If you save the analysis and publish on the library with the "6 months" value and uncheck the "Remember personalized view for each web client user" every time they revisit the page when you open the dashboard, the 6 month value should remain there. Alternatively, you could create a script to run as soon as the page is revisited without having to reload the analysis to reset the document property to a default value (e.g. 6 months) Link to comment Share on other sites More sharing options...
Shirly Soloman Posted June 8, 2023 Author Share Posted June 8, 2023 Hello Jose,Thank you for looking into it.Please help me with the script as I am not well versed right now with IronPython. Link to comment Share on other sites More sharing options...
Jose Leviaguirre Posted June 8, 2023 Share Posted June 8, 2023 You can add a reset button (Action Control) with the following IronPython script to reset to the default expression like this:Document.Properties["DateRangeExpression"] = "[Date] >= dateadd('mm',-6,Max([Date]))"This script assumes you have a Drop-down list Property Control linked to a document property called "dateRangeExpression" that holds 3 values:So the script will "reset" to the default value for the 6 month expression. Please note that the expression on the Script and on the drop-down list have be exactly the same. Otherwise you will get "---"Now, if you want to have that button automatically clicked when you revisit the page, you will need a JavaScript to do so. You will first need to wrap the reset button with some html:<span id=resetButton> <SpotfireControl id="1e84eda67d3c44c5b179f8419adc58be" /> ◄ reset button</span>And add this JavaScript to automatically click the button when you revisit the pagedocument.querySelector("#resetButton input").click() If you do not want to have the reset button visible, you can hide it by adding the hidden attribute on the wrapper of your button:<span id="resetButton" hidden><SpotfireControl id="1e84eda67d3c44c5b179f8419adc58be" /></span> Link to comment Share on other sites More sharing options...
Shirly Soloman Posted June 9, 2023 Author Share Posted June 9, 2023 Thanks for the solution.It has fixed my issue. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now