Aman Alok Posted February 11, 2019 Share Posted February 11, 2019 I have a requirement wherein I have to store value of a label to a variable. I see that there is a function called getDocumentProperty().But I'm not able to understand its signature listed as: function getDocumentProperty(propertyName, callback); So I want something like below. var value=getDocumentProperty("property_name", callback function); Could somebody provide an example to illustrate(esp. the callback function) Thanks Link to comment Share on other sites More sharing options...
Shandilya Peddi Posted February 11, 2019 Share Posted February 11, 2019 You can set the variable's value in the call back function something as below doc.getDocumentProperty("propertyName",function(Property){ value=Property.value; }); Link to comment Share on other sites More sharing options...
Aman Alok Posted February 18, 2019 Author Share Posted February 18, 2019 So , for example I have a doc property control named " threshold" which is an input field. Once a user inputs an integer , that value should be stored to a variable named "v" (which should be alerted).. So, can I write like below(which is not working) Could you please help set the variable "v" up. var v= doc.getDocumentProperty("threshold",function(Property){ value=Property.value; });alert(v); Thanks Link to comment Share on other sites More sharing options...
Shandilya Peddi Posted February 19, 2019 Share Posted February 19, 2019 Can you quickly test this and see if it works, var v= doc.getDocumentProperty("threshold",function(Property){ v=Property.value; }); Link to comment Share on other sites More sharing options...
Aman Alok Posted February 21, 2019 Author Share Posted February 21, 2019 Hi, I testedthe following code snippet provided by you but it returns "undefined". Looks like the following snippet should be executed after the page has finished loading.Do you feel we have to make use of the method onDocumentReady(callback function) hereIf yes, how Please help. var v= doc.getDocumentProperty("threshold",function(Property){ v=Property.value; }); alert(v); //returns "undefined" Thanks Link to comment Share on other sites More sharing options...
Shandilya Peddi Posted February 21, 2019 Share Posted February 21, 2019 Since you mentioned that you want to set the variable only when the user enters a value to the document property, may be you can use the onDocumentPropertyChange() as well. It would be something as below doc.onDocumentPropertyChange("threshold",function (Property) {v=Property.value;} );https://docs.tibco.com/pub/spotfire_server/7.5.0/doc/api/TIB_sfire_server_Web_Player_JavaScript_API_Reference/html/M_spotfire_webPlayer_Document_onDocumentPropertyChanged.htm If you want to use the onDocumentReady(), then the sample JS would be as below,doc.onDocumentReady( function{var v= doc.getDocumentProperty("threshold",function(Property){ v=Property.value; });});https://docs.tibco.com/pub/spotfire_server/7.5.0/doc/api/TIB_sfire_server_Web_Player_JavaScript_API_Reference/html/M_spotfire_webPlayer_Document_onDocumentReady.htmhttps://community.spotfire.com/wiki/tibco-spotfire-javascript-api-overview 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