spotfiretibcospotfire-webplayer

Inserting Document property in an URL for a spotfire dxp


I have an URL where certain attributes can be changed and the corresponding data will be pull when the URL is executed in a browser. The general content of the URL is like so:

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_&trendStyle=Mean&xAxis=DateLotWafer&title=Fdc%20Trend%20Analysis

The parts in bold are the ones that can dynamically change. I have a table in spotfire (dcube) that has a list of the toolId, chamberId , senSorName and stepId. I have set it up such that when the user clicks on a row, it captures those attributes to 4 document properties. I use the text area to provide a link, but is there a way to control the URL of the link so that I can insert the document properties in those 4 places in the URL?

Any insight would help. Thank You


Solution

  • You can use an Python script to update the HTML in a text area. Using your document properties in the script you can build the link you need. Since the document properties are updated on a marking you can add this to your document properties so when they change the url is updated.

    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()