Jump to content

How to set time range from current year to max year from data source


Szymon Mon

Recommended Posts

Hi,

I created IronPython script where set range of time which is available to show on the report but there is one drawback, the year are hard coded.

I have column called "Dates" which has of the type as datetime. Based on it created new column which extract year from date and its date type is integer. It is called "Year" in below code.

I would like to change "Year" filed to "Dates" and set Values as shown on the right side of last line: year(DateTimeNow), Max(Dates)

from Spotfire.Dxp.Application import Filters

from Spotfire.Dxp.Application.Filters import RangeFilter,ValueRange

from Spotfire.Dxp.Application.Filters import FilterTypeIdentifiers

from System import DateTime

from System.Globalization import CultureInfo

myPanel=Document.ActivePageReference.FilterPanel

myFilter=myPanel.TableGroups[0].GetFilter("Year") --> Dates

lblFilter=myFilter.FilterReference.As[RangeFilter]()

lblFilter.ValueRange=ValueRange(2019, 2029) --> (year(DateTimeNow), Max(Dates))

Link to comment
Share on other sites

  • 1 month later...

You can create two calculated columns in your table with current and max year or have those columns in your information link.

In your python script, you can just extract the values of two columns from first row using DataValueCursor and break the loop using break; statement once the first row values are extracted:

https://community.spotfire.com/wiki/how-retrieve-table-column-values-tibco-...

 

for row in table.GetRows(cursor,cursor1):

current = cursor.CurrentValue

maxdate = cursor1.CurrentValue

break;

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...