BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
1 ACCEPTED SOLUTION

Accepted Solutions
Renato_sas
SAS Employee

Hi @r0oki3,

 

You could use a button bar that is populated with only one value (e.g. "Reset"), but you would have to uncheck the Required checkbox in the button bar options pane. Because a VA button bar doesn't behave like an application button in the sense that a mouse button down presses the button and a mouse button up releases the button, you still need to click twice in the VA button: first to select the button (press) and then to unselect it (release).

 

Best,

Renato

View solution in original post

10 REPLIES 10
Renato_sas
SAS Employee

Hi @r0oki3,

 

You could use a button bar that is populated with only one value (e.g. "Reset"), but you would have to uncheck the Required checkbox in the button bar options pane. Because a VA button bar doesn't behave like an application button in the sense that a mouse button down presses the button and a mouse button up releases the button, you still need to click twice in the VA button: first to select the button (press) and then to unselect it (release).

 

Best,

Renato

r0oki3
Obsidian | Level 7

thank you for the clarification. It's better to use a two button.

 

 

DJongman
Obsidian | Level 7

Hi r0oki3,

 

You could use 1 button that acts based on a 'one click' in VA.

 

For example I have used the CARS datasource

 

Created a parameter called reset filter

 

image.png

 

Created a calculated field called 'Reset filter'

 

image.png 

 

Add a button  and some measures 

 

image.png

 

Button:

 

image.png

 

Created a new calculated field for the prompt I a using:

 

image.png

 

Connect the calculated field 'Origin_prompt' to a list:

(List is created in section prompt field)

 

image.png

 

 

So if you now select for example 'Asia' the report is filtered on Asia. If you select the button it will reset all list values.

 

Note1: for every prompt you are using, you need to create there own calculated field.

 

Note2: Don't know if the above will work quick on a large database / with much prompts.

 

r0oki3
Obsidian | Level 7

I am on SAS VA 8.2 and I am not displaying the same prompts in my list table. Plus I have more than 5 prompts. Thank you for the idea, but it does not apply to my situation.

Renato_sas
SAS Employee

I think the solution that @DJongman proposed is interesting and should be evaluated. I don't see much difference on the requirements he described compared with the previous solution, so if the previous one works, this one should work too, with the advantage that you now have a single value button. 

 

I've tested it in VA 8.2 and it worked, but I took the liberty to rewrite it to use the new isSet operator. I think it helps clarify why and how this solution works.

 

The calculated item used to populate the button is rewritten like this:

 

IF NOT(( 'p_Reset'p IsSet ))
RETURN 'Reset all filters'
ELSE 'Resetting'

 

And the calculated item used to populate the prompt (for Make for example) becomes this:

 

IF NOT(( 'p_Reset'p IsSet ))
RETURN 'Make'n
ELSE 'Resetting...'

 

This solution works because the parameter p_Reset is initially not set to any value and the button displays 'Reset all filters'. Every time you click on the button, the parameter is set to a value ('Reset all filters'), forcing the button label to change to 'Resetting', and every time the data behind a button changes, the button goes back to its default state, which is nothing selected. This sets the parameter back to a "not set" state which in turn changes the button label back to "Reset all filters". Flipping the value of the parameter back and forth between a not set and a set state is all that you need to trigger the control object (prompt) to be reset, as its underlying data changes and the prompt values are reloaded with nothing selected.

 

I really like it and I'd definitely give it a try.

 

best,

Renato

Renato_sas
SAS Employee

Just a quick update:

 

I've just tested it on the latest VA release (8.3 September Update) and it didn't work. For some reason the button label doesn't momentarily change to 'Resetting' and then goes back to 'Reset all filters'. It remains as 'Reset all filters' in a selected state, most likely because starting with VA 8.3, VA is able to retain the state of user selections, and it may be interfering with the logic that the solution is trying to apply.

r0oki3
Obsidian | Level 7

1. I did the same steps as you mentioned for 11 filters which are a mix of drop down and lists. In VA I get an error as soon as I select a filter value as below

 

 Reset.JPG

 

but here the button bar when clicked changes from 'Reset all filters' to Resetting and back to 'Reset all filters'.

 

2. When I open the report in report viewer, the filters work fine and I do not see the above error but the button bar when clicked to Reset changes to Resetting and is not changing back to Reset all filters. Once I click multiple times on the button, probably 2 or 3 then it changes back to Reset all filters.

 

@Renato_sas are you facing anything like this. @DJongman thank you for the idea.

Renato_sas
SAS Employee

Indeed, it seems that VA 8.2 Report Viewer behaves differently. The first time you click on the button it changes to 'Resetting', but it's not selected. The second time you click it remains in 'Resetting' but the button is now selected. The third time you click in the button it goes back to 'Reset all filters' and it's not selected, which is the original state. Three clicks total. because of that, I guess the original proposed solution is still the best one, at least for VA 8.2.

 

I didn't get any errors like you did, but my report is different, so there might be something else in your report that is causing it.

jkaur
Calcite | Level 5

Hi, is the originally proposed solution supposed to work for all filters? I have 4 filters in a report and clicking on reset and then release only clears the first filter. Am I doing something wrong?

r0oki3
Obsidian | Level 7

If you do this for all the filters, it should work.

 

Expression for Resetable Product

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 10 replies
  • 6906 views
  • 1 like
  • 4 in conversation