如何明确告诉用户等待脚本在Spotfire中完成

时间:2022-08-23 18:13:46


I need some advise accomplishing the action on the title o this thread; let me elaborate, I have a Spotfire analysis where the data to be used is controlled by a cascading set of drop-down menus, each one linked to a document property. The way it works is that the user selects a value in the 1st drop-down, and in the background, a script runs that automatically limits the options available for the following drop-down menu. This behavior repeats in the second and third drop-down selectors.

This works as expected. However, my problem is that a great number of operations ocurr in the background when these document properties change, such as recalculation of sevreal fairly large table merges, recalculation of a many columns on several other tables down the analysis, etc.

All of these take a long time to execute, and the problem is that the users end up looking an unresponsive screen while these actions take place.

What I need is a way to indicate the user that the analysis is not hung up and they just need to wait until the background operations complete before proceeding to make a selection on the next drop-down menu.

I've tried simple stuff as creating a document property that gets assigned a value as soon as the drop-down script is clicked on, and then the same property gets reset at the end of the script, using the property value to indicate that the script has or hasn't completed, but this approach doesn't work.

我需要一些建议来完成对这个帖子的标题的动作;让我详细说明,我有一个Spotfire分析,其中要使用的数据由一组级联的下拉菜单控制,每个菜单都链接到一个文档属性。它的工作方式是用户在第一个下拉列表中选择一个值,在后台运行一个脚本,该脚本会自动限制下面的下拉菜单中可用的选项。此行为在第二个和第三个下拉选择器中重复。这按预期工作。但是,我的问题是当这些文档属性发生变化时,后台会出现大量操作,例如重新计算sevreal相当大的表合并,重新计算分析中的其他几个表上的许多列等等。所有这些都需要执行时间很长,问题是当这些操作发生时,用户最终会看到无响应的屏幕。我需要的是一种方法来指示用户分析没有挂起,他们只需要等到后台操作完成后再继续在下一个下拉菜单中进行选择。我尝试过简单的东西,比如创建一个文档属性,只要单击下拉脚本就会分配一个值,然后在脚本结束时重置相同的属性,使用属性值指示脚本已经或尚未完成,但这种方法不起作用。

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

#
# Updates a dependent control, setting the value of the 
# dependent property according to the first valid value 
# for that property.
#
# This script should be configured to run when the independent
# control is changed
#
# Andrew Berridge, TIBCO Spotfire, July 2014, Revised September 2016

from Spotfire.Dxp.Data import *

#Updates one or more dependent property based on the selection made in another drop-down control
independentPropertyValue = Document.Properties[independentPropertyName]
Document.Properties["readyToDisplay"] = "No"

i = 0
for dependentPropertyName in dependentPropertyNames.Split(","):
    dependentPropertyName = dependentPropertyName.Trim()
    dependentValuesDataTableName = dependentValuesDataTableNames.Split(",")[i].Trim()
    dependentValuesDataTable = Document.Data.Tables[dependentValuesDataTableName]
    dependentPropertyName = dependentPropertyNames.Split(",")[i].Trim()
    dependentPropertyValue = Document.Properties[dependentPropertyName]
    dependentValuesColumnName = dependentValuesColumnNames.Split(",")[i].Trim()
    dependentValuesColumnCursor = DataValueCursor.CreateFormatted(dependentValuesDataTable.Columns[dependentValuesColumnName])
    independentValuesCursor = DataValueCursor.CreateFormatted(dependentValuesDataTable.Columns[independentValuesColumnName])
    firstValidValue = ""
    for row in dependentValuesDataTable.GetRows(dependentValuesColumnCursor, independentValuesCursor):
        independentValue = independentValuesCursor.CurrentValue
        val = dependentValuesColumnCursor.CurrentValue
        if independentValue == independentPropertyValue and val != "(Empty)" :
            if firstValidValue == "" : 
                firstValidValue = val
                break

    print "Setting value of dependent property " + dependentPropertyName + " to: " + firstValidValue
    Document.Properties[dependentPropertyName] = firstValidValue
    i += 1

Document.Properties["readyToDisplay"] = "Yes"
#print "readyToDisplay is " + Document.Properties["readyToDisplay"]

Any ideas on how to go about this problem?

In simple terms, I just need a way to indicate to the user that "stuff" is happening in the background after making a selection in any of the the drop-down menu selector, as well as notifying them when the system is ready for them to make the following selection and so on.

Thanks

关于如何解决这个问题的任何想法?简单来说,我只需要一种方法来指示用户在任何下拉菜单选择器中进行选择后在后台发生“东西”,并在系统准备好时通知他们进行以下选择等。谢谢

Mario Reyes

马里奥雷耶斯

1 个解决方案

#1


0  

Please take a look at this sample to add a progressbar while the script executes-

请在脚本执行时查看此示例以添加进度条 -

https://community.tibco.com/wiki/how-add-progress-bar-and-cancellation-option-when-executing-ironpython-scripts-tibco-spotfire

https://community.tibco.com/wiki/how-add-progress-bar-and-cancellation-option-when-executing-ironpython-scripts-tibco-spotfire

#1


0  

Please take a look at this sample to add a progressbar while the script executes-

请在脚本执行时查看此示例以添加进度条 -

https://community.tibco.com/wiki/how-add-progress-bar-and-cancellation-option-when-executing-ironpython-scripts-tibco-spotfire

https://community.tibco.com/wiki/how-add-progress-bar-and-cancellation-option-when-executing-ironpython-scripts-tibco-spotfire