首页 > 解决方案 > 在 spotfire dxp 的 URL 中插入 Document 属性

问题描述

我有一个 URL,其中某些属性可以更改,并且在浏览器中执行 URL 时将提取相应的数据。URL 的大致内容是这样的:

https://server/App/Detect.do?dm=Rel&daysBack=60&toolId= ETX500 &chamberId= PM5 &senSorName= Lower_Middle_Temperature_Mean &stepId= POLY &module=&fdcApplication=&contextGroup=&sampleSize=25&recentLots=&dateLotWafer=true&_dateLotWafer=on&chartIndex=0&groupTBy=UserTag&priorByKeyGroupBysUser= _NA_&trendStyle=平均值&xAxis=DateLotWafer&title=Fdc%20Trend%20Analysis

粗体部分是可以动态变化的部分。我在 spotfire (dcube) 中有一个表,其中toolId包含chamberIdsenSorNamestepId. 我已将其设置为当用户单击一行时,它将这些属性捕获到 4 个文档属性。我使用文本区域提供链接,但有没有办法控制链接的 URL,以便我可以在 URL 的这 4 个位置插入文档属性?

任何见解都会有所帮助。谢谢你

标签: spotfiretibcospotfire-webplayer

解决方案


您可以使用 Python 脚本来更新文本区域中的 HTML。使用脚本中的文档属性,您可以构建所需的链接。由于文档属性在标记上更新,因此您可以将其添加到文档属性中,以便在它们更改时更新 url。

from Spotfire.Dxp.Application.Visuals import HtmlTextArea
#Set vis as script parameter to a text area visual
vis = vis.As[HtmlTextArea]()

def UpdateUrl():    
    attr1 = Document.Properties['DocProp1']
    attr2 = Document.Properties['DocProp2']
    url = "http://www.google.com?ID={}&SaleID={}".format(attr1,attr2)   
    htmlText = '''<a href="{}" target="_blank">Click Here</a>'''.format(url)    
    vis.HtmlContent = htmlText  # can use vis.HtmlContent += to append instead of replace
 
UpdateUrl()

推荐阅读