IronPython script to cancel background tasks in TIBCO Spotfire®
Last updated:
9:04am Jun 11, 2017

Introduction

TIBCO Spotfire® is a powerful tool that can be used to create calculated columns, build predictive and machine learning models etc. Users of Spotfire's web clients however currently do not have an option to interrupt these long running tasks. The below IronPython script can be used in a script button to allow web users to cancel the background tasks. Of course, this also works in the Spotfire desktop clients.

Cancel background tasks

The below script can be used to cancel background tasks

# Copyright © 2017. TIBCO Software Inc.  Licensed under TIBCO BSD-style license.

# Import the necessary packages
from Spotfire.Dxp.Framework.ApplicationModel import *

ps = Document.Context.GetService(ProgressService)

# Print title, description and cancellation status, cancel the task then print the cancellation status again
for ph in ps.BackgroundProgresses:
	print ph.Title
	print ph.Description
	print ph.IsCanceled
	ph.Cancel()
	print ph.IsCanceled

 

License:  TIBCO BSD-Style License