问题描述
我有一个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&groupBy = UserTag&priorGroupBys = UserTag&priorGroupByKeys = _NA_&trendDate =%Mean&xAxis
粗体部分是可以动态更改的部分。
我在Spotfire(dcube)中有一个表,其中有toolId
,chamberId
,senSorName
和stepId
的列表。我已经进行了设置,以便当用户单击一行时,它会将这些属性捕获到4个文档属性中。
我使用文本区域提供链接,但是有没有办法控制链接的URL,以便可以在URL的那四个位置插入文档属性?
任何见识都会有所帮助。 谢谢
解决方法
您可以使用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()