Jump to content

Pass calculated value thru to a document property

Julie Schellberg 3

Recommended Posts

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

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

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
print theDate



Link to comment
Share on other sites

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

  • 1 month later...
  • 3 years later...

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

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