Jump to content

How to set the exact range of a range filter in text area through iron python?


Alan F
Go to solution Solved by Alan F,

Recommended Posts

Hello, everyone!

I wonder is there any properties or methods to let me utilize values from document properties to set the specific range for a range filter which is from a table filter scheme and placed in the text area. I tried to use the ValueRange property but the outcome was not what I want.

The original status:
image.thumb.png.44bfbc8eea71a3d463c00c0374c769fa.png

What I expected after executed the iron python script:
image.thumb.png.0a3a23ae3f324854fd2f2ea70aa3d8a4.png

Hope you can provide some methods and a completed namespace to import and simple example, which may include how to called the methods and what arguments needed.

Link to comment
Share on other sites

  • Solution

The problem seems fixed, thank you all for your consideration, the above issues seems due to my mistake that input wrong data data. The following code is worked:

from Spotfire.Dxp.Application import Filters as filters
from Spotfire.Dxp.Application.Filters import ValueRange
from System import DateTime

myPanel = Document.ActivePageReference.FilterPanel

for filterGroup in myPanel.TableGroups:
    if filterGroup.Name == 'Radar Health':
        myFilter = filterGroup.GetFilter("DateTime")

rangeFilter = myFilter.FilterReference.As[filters.RangeFilter]()

startTime = DateTime.ParseExact('28/2/2023 6:02:21 pm', 'dd/M/yyyy h:mm:ss tt', None)
endTime = DateTime.ParseExact('28/2/2023 6:10:07 pm', 'dd/M/yyyy h:mm:ss tt', None)
rangeFilter.ValueRange = ValueRange(startTime, endTime)

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...