Script to assert values into numeric filter

Hey, I’m trying to write a script for a button that will pull a value from a text box (value entered by user) and put it into either the upper or lower bound of a numeric range-number filter. However, I cannot find where those upper and lower bounds are in the object.

Anyone know where I can find them?

Thanks!

A range filter’s parameter value would be a RangeNumberValue type.

https://www.dundas.com/support/api-docs/js/#API%20Reference/dundas/data/RangeNumberValue/cindex.html

As such, the upper and lower value that are set in the filter control can be seen in this object through the upperBoundaryValue and lowerBoundaryValue properties respectively.

https://www.dundas.com/support/api-docs/js/Content/API%20Reference/dundas/data/RangeNumberValue/Properties/upperBoundaryValue.html
https://www.dundas.com/support/api-docs/js/Content/API%20Reference/dundas/data/RangeNumberValue/Properties/lowerBoundaryValue.html

1 Like

Thank you.

So… how do I find that?

This is the part I always struggle with. My filter is called upperFilter, so I tried…
upperFilter.control. but it’s not there
upperFilter.data doesn’t exist
etc etc.

I just don’t know how to read those pages of info and translate them into the property’s location in the object. What am I missing?

OK, I looked around and happened upon some code that grabs the parameter. And I can set the value. But the number displayed in the filter doesn’t change, nor does the table refresh based on the new value.

var view = this.parentView.control;
var param = view.getViewParameterByName(“upperFilterParameter”);
param.parameterValue.upperBoundaryValue = 2;

Heh, and I keep digging and digging and finally find someone else on a similar mission as I am:

param.refreshAllAdapters();

This did the trick. I guess the moral of the story is that if you wait long enough, I’ll eventually figure it out on my own lol :upside_down_face:

Glad to see you managed to work through it! For future reference, here’s a sample we have - in the code snippet, make you always include the invalidate and refresh calls after updating a view parameter.

https://www.dundas.com/Support/learning/documentation/create-view-content/how-to/set-filter-value-by-script

viewParameter.invalidateParameterValueLastModifiedTime();
viewParameter.refreshAllAdapters();
1 Like