Julie Schellberg 3 Posted July 22, 2016 Share Posted July 22, 2016 Ultimately, what I am trying to do is get visualization titles to update with the current date. I was trying to do this by using html and javascript to pass a calculated value (using the datetimenow function) through to a document property that could then be referenced in a title. I was working off of this blog post --http://spotfired.blogspot.com/2015/01/extract-calculatedvalue-to.html. However, what I would up with from this post was a connection between the input property (rather than the calculated value). Ican't figure out how to connect the document property and the calculated value. Thanks in advance. Link to comment Share on other sites More sharing options...
Shanmugam Saravanan Posted July 26, 2016 Share Posted July 26, 2016 Could you please let me know where you got stuck up. Below code set the calc value to doc prop $("#inputPropertyControl input").val(value).blur(); Link to comment Share on other sites More sharing options...
Julie Schellberg 3 Posted July 26, 2016 Author Share Posted July 26, 2016 I created the calculated value in the text area. In the Values menu for the calculated value, I right clicked on the variable selected and selected Custom Expression and entered the expression DateTimeNow(). When I exited out, I have a calculated value that is today's date and time. I don't know how to connect that to a document property that could be referenced in the title of a visualization. Is the code you suggested JavaScript I tried creating an input property control and then entering that code as a JavaScript in the html editor but wasn't able to make the calculated value update the property control. Link to comment Share on other sites More sharing options...
Shanmugam Saravanan Posted July 28, 2016 Share Posted July 28, 2016 So, All you need is current date/time to be stored in document prop. use this below script to get date and get it stored in document prop. If you want this script to loaded on page load. write in a button and trigger the script using javascript on load. import clr from System import DateTime theDate = DateTime.Today Document.Properties["dt"]=theDate print theDate Link to comment Share on other sites More sharing options...
Julie Schellberg 3 Posted July 29, 2016 Author Share Posted July 29, 2016 I had already found an answer to this problem, but your suggestion had fewer steps. For the sake of completeness, what I did was 1. Created an input property control 2. Attached your script to that property control 3. Added the document property to the title. 4. Edited the HTML in the text area to hide the input property control Thank you for the input! Link to comment Share on other sites More sharing options...
Julie Schellberg 3 Posted August 1, 2016 Author Share Posted August 1, 2016 Do you know the javascript for triggering on load Link to comment Share on other sites More sharing options...
Shanmugam Saravanan Posted August 2, 2016 Share Posted August 2, 2016 use below javascript to trigger the button on page load.$(function () { function executeScript() { $('#hiddenBtn input').click(); //or- document.getElementById('hiddenBtn').childNodes[0].click(); } $(document).ready(function(){executeScript()}); }); Link to comment Share on other sites More sharing options...
Julie Schellberg 3 Posted September 9, 2016 Author Share Posted September 9, 2016 Here is the solution I wound up using instead. http://datashoptalk.com/using-javascript-to-set-the-title-of-a-visualiza... Link to comment Share on other sites More sharing options...
Geetika Saini Posted February 5, 2020 Share Posted February 5, 2020 Can we use Text area property to create a calculated columneg. I have a column which store dates in UTC, using above mentioned script I am able to get current date in the Text area, but now I want to create a column in my existing table which gives me the difference between current Time and time I have in the calculated column 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