Jump to content

Reproducing IronPython functionality Spotfire Cloud


astones

Recommended Posts

Hi,

I have a very simple script which runs when a document property is changed.

properties = {
	“X”: “resultsX”,
	“Y”: “resultsY”,
	“Z”: “resultsZ”,
}

for field, property in properties.items():
	Document.Properties[property] = field if Document.Properties[“results”] == field else "Placeholder"

The problem is that for security reasons, IronPython scripts will not run in Spotfire Cloud, which is what we have. Is there another way to reproduce this functionality, e.g. by using TERR?

Thanks!

Adam

Link to comment
Share on other sites

Hello @astones!

You're able to run data functions in your Spotfire Cloud instance? If so, it's pretty simple... if you have a static set of document properties to watch. If you have a dynamic set of document properties (for instance, if sometimes it's three, but other times it's four), it's a bit trickier. Assuming static, your R data function would have a set of input and output parameters (one for each of the X, Y, Z properties). The function itself would be something like this:

for (i in seq(1, 3)){
	chkVal <- get(paste0("inProp", i))
	if (resProp == chkVal){
		assign(paste0("outProp", i), chkVal)
	} else {
		assign(paste0("outProp", i), "Placeholder")
	}
}

resProp is an input parameter for your Document.Properties["results"], chkVal gets set to your input document properties. You can expand the list of document properties by adding additional input and output parameters and adjusting the first line of the script. In the seq(1, 3) bit, just change 3 to whatever number of properties.

image.png.5f489683bebbeb6793b802d3c5e6bdc9.png

image.png.240f8847cba0c9686c3a49da82870857.png

image.png.6b68d5e10567bbc9ed77a6b49581e406.png

Edited by barchiel33
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...