Govindaraj Sanjeevi Posted March 21, 2017 Share Posted March 21, 2017 Hi, I have created Document Property named as test In python, we can update like Document.property["property_name"] = "Hello world" Can we able to set Document Property through Javascript Environment spotfire 7.7.0 Thanks, Govindaraj Sanjeevi Link to comment Share on other sites More sharing options...
Sean Riley Posted March 21, 2017 Share Posted March 21, 2017 You cannot use the API like you do in IronPython, so instead you need to have an Input Field property control which you update, and that in turn updates the document property value. See this KB for an example: How to automatically set a property value to the current date/time with a Text Area JavaScript. https://support.tibco.com/s/article/ka11a000000HoWqAAK/Tibco-KnowledgeAr... In your text area, wrap your Input Field property control, which is based on the document property you want to update, in a div with id: Then in your JavaScript you can set the value of that element which will in turn update the document property value: //////////////////////////////////////////////////// // Set an Input field value to the current date/time //////////////////////////////////////////////////// // Get Input field property control by its ID var elem = document.getElementById("myInputField"); //Get currentdate var currentdate = new Date(); //Format time parts to 2 digits currentHours = currentdate.getHours(); currentHours = ("0" + currentHours).slice(-2); currentMinutes = currentdate.getMinutes(); currentMinutes = ("0" + currentMinutes).slice(-2); currentSeconds = currentdate.getSeconds(); currentSeconds = ("0" + currentSeconds).slice(-2); //Create final date time format var datetime = (currentdate.getMonth()+1) + "/" + currentdate.getDate() + "/" + currentdate.getFullYear() + " " + currentHours + ":" + currentMinutes + ":" + currentSeconds; //Set the element value with the datetime elem.childNodes[1].value = datetime; Link to comment Share on other sites More sharing options...
Roman Ergakov Posted September 8, 2017 Share Posted September 8, 2017 setDocumentProperty(propertyName, PropertyValue); works fine. ) Link to comment Share on other sites More sharing options...
Aaron Cediel Posted October 22, 2019 Share Posted October 22, 2019 Hi, This solution no longer works for Spotfire X + versions. A possible fix/solution/workaround could be this: https://community.spotfire.com/questions/assigning-values-document-properti... Hope it helps, Aaron 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