我正在按需加载数据表,并将其链接到上一个选项卡中的标记。数据表如下所示:
ID Values
1 365
2 65
3 32
3 125
4 74
5 98
6 107
我想根据 ID 的不同计数来限制引入此新可视化的数据。
我目前正在使用 属性中的“按表达式限制数据”部分。 我的表情在哪里
UniqueCount(ID) <= 1000
这工作得很好,但是,我还希望它显示一条消息,例如 “选择的 ID 太多。最大限制为 1000”
我正在考虑使用属性控件来执行此操作,其中属性控件会触发 Iron Python 脚本。关于如何编写该脚本有什么建议吗?
最佳答案
一种解决方法是在页面上使用一个小文本区域(可能作为标题)。您可以插入动态项
-> 计算值或图标,并让它根据标记(选择)执行计数或唯一计数。例如,一旦 Count(ID) > 1000,文本就会更改为红色,或者图标会更改颜色。这是一种轻处理替代方案,不一定会创建弹出窗口,但仍然可以向用户提供已选择过多行的即时通知。
编辑如下:
<!-- Invisible span to contain a copy of your value -->
<span style="display:none;" id="stores-my-count"><span id="seek-ender"></span></span>
\\Javascript below to grab dynamic item element's value and put it into a span
\\To be executed every time the dynamic value changes
$("#DynamicItemSpotfireID").onchange = function() {
var myCount = $("#DynamicItemSpotfireID").text();
$("#stores-my-count").append(myCount);
}
#IronPython script to locate the value placed into the span by the JS above
#and put only that portion of the page's HTML (only the value) into a document property
parentSpan = '<span id="stores-my-count">'
endingSpan = '<span id="seek-ender">'
startingHTML = myTextArea.As[VisualContent]().HtmlContent
startVal = startingHTML.find(parentSpan, startingIndex, endingIndex) + len(parentSpan)
endVal = startingHTML.find(endingSpan, startingIndex, endingIndex)
Document.Properties["myMarkingCount"] = startingHTML[startVal:endVal]
我还没有测试大部分代码,我将其作为开始思考问题的地方,而不是交 key 解决方案。希望它只需要进行一些小的调整就可以工作。
关于TIBCO Spotfire 中的 Python 脚本显示自定义消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39907870/