Jump to content
We've recently updated our Privacy Statement, available here. ×

In my case As per Document property value will be shown in the start and date, But my new requirement is End date is the default current date and Start date is the default current date -12 months, How can i solve this issue. R script shows error.

Bharath V

Recommended Posts


It could help if you describe in more detail exactly what you are trying to achieve.  

If all you want to do is to update two document properties - EndDate and StartDate - to the stated values, e.g. when the analysis is opened, I recommend that you look into using the Custom DateTime Data Function for TIBCO Spotfire that is available in the community: https://community.spotfire.com/s/article/Custom-DateTime-Data-Function-for-TIBCO-Spotfire

As stated there: "The main goal of the Custom DateTime Data Function for TIBCO Spotfire® is to enable the running of IronPython scripts on Analysis Open, Filter and Marking changes. The Custom DataTime Data Function allows one to trigger IronPython scripts without having to use a TERR/statistical Data Function for only that purpose."

You could then simply set your document properties in an IronPython script like this


from Spotfire.Dxp.Data import DataType, DataValuefrom System import DateTime endDate = DateTime.TodaystartDate = endDate.AddMonths(-12) sEndDate = DataValue.Create(DataType.Date,endDate.Date) sStartDate = DataValue.Create(DataType.Date, startDate.Date) Document.Properties["StartDate"] = sStartDate.ValidValueDocument.Properties["EndDate"] = sEndDate.ValidValue



Link to comment
Share on other sites

  • 1 month later...

Thanks for the answer Fredrik Rosell.

Used the same iron python script in my case, But if I’m changing the value manually then only End and Start date will changed, Default value is not shown in the report.

Link to comment
Share on other sites


I'm afraid that I don't understand so please explain in more detail and illustrate with screenshots what happens.

Do you e.g. mean that after you have manually set the end and start date document property values and saved the analysis, the next time you open the analysis (and you have configured the Custom DateTime Data Function I mentioned to run the IronPython script when the analysis is opened), the End and Start dates are not updated using the default value (today, and today - 12 months)? Are they correctly updated if you manually run the IronPython script?

Link to comment
Share on other sites

Hello Afraid , Thanks for the replay.

From Spotfire.Dxp. Data import Data Type,DataValue

From System import DateTime

today= DateTime.Now

oneMonthAgo= today.AddMonths(-1)


sOneMonthAgo= DataValue.Create(DataType.Date,oneMonthAgo.Date)


Document.Properties[“SamplingStartDate”]=SOneMonthAgo.ValidValue (This script I m using for Default value, Assign the DP through the Expression), I m trying to assign the DP instead of Expression , That wont be assigned, After Click OK, Dp will be removed.

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