Bharath V Posted November 20, 2023 Share Posted November 20, 2023 Link to comment Share on other sites More sharing options...
Fredrik Rosell Posted November 21, 2023 Share Posted November 21, 2023 Hello, 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, DataValue from System import DateTime endDate = DateTime.Today startDate = endDate.AddMonths(-12) sEndDate = DataValue.Create(DataType.Date,endDate.Date) sStartDate = DataValue.Create(DataType.Date, startDate.Date) Document.Properties["StartDate"] = sStartDate.ValidValue Document.Properties["EndDate"] = sEndDate.ValidValue Reference: https://learn.microsoft.com/en-us/dotnet/api/system.datetime?view=net-8.0&redirectedfrom=MSDN#methods Link to comment Share on other sites More sharing options...
Bharath V Posted January 8 Author Share Posted January 8 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 More sharing options...
Fredrik Rosell Posted January 8 Share Posted January 8 Hello,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 More sharing options...
Bharath V Posted January 8 Author Share Posted January 8 Hello Afraid , Thanks for the replay.From Spotfire.Dxp. Data import Data Type,DataValueFrom System import DateTimetoday= DateTime.NowoneMonthAgo= today.AddMonths(-1)sToday=DataValue.Create(DataType.Date,today.Date)sOneMonthAgo= DataValue.Create(DataType.Date,oneMonthAgo.Date)Document.Properties[“SamplingEndDate”]=sToday.ValidValueDocument.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 More sharing options...
Fredrik Rosell Posted January 9 Share Posted January 9 Hello,It would likely be easier for someone to troubleshoot your issue if you could provide a sample dxp file that illustrates the issue. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now