IPython script runs on Spotfire Client, not Spotfire Web

I have the following python script (reduced, but the rest of it performs similar actions):

    from Spotfire.Dxp.Application.Visuals import *
    from Spotfire.Dxp.Data import *

    #assign default values for prompts if needed
    if Document.Properties['cannedKPISelected'].isspace():
        Document.Properties['cannedKPISelected'] = 'GS'
    if Document.Properties['cannedTimeSelected'].isspace():
        Document.Properties['cannedTimeSelected'] = 'Month'
    
    #determine which type of viz needs displayed based on a flag in the data
    tableName='PrimaryDataTable'
    columnToFetch='displayPercentageFlag'
    activeTable=Document.Data.Tables[tableName]
    rowCount = activeTable.RowCount
    rowsToInclude = IndexSet(rowCount,True)
    cursor1 = DataValueCursor.CreateFormatted(activeTable.Columns[columnToFetch])
    for row in activeTable.GetRows(rowsToInclude,cursor1):
        rowIndex = row.Index
        percentageNeeded = cursor1.CurrentValue
        break
    
    #create consumer report
    for page in Document.Pages:
        for viz in page.Visuals:
            if str(viz.Id) == 'a7f5b4ec-f545-4d5f-a967-adec4c9fec79':
                if Document.Properties['coffeeReportSelected'] == 'Brand Category by Market':
                    if Document.Properties['cannedKPISelected'] == 'GS' and Document.Properties['cannedTimeSelected'] == 'Month' and percentageNeeded == 'Y':
                        visualContentObject = viz.As[VisualContent]()
                        visualContentObject.MeasureAxis.Expression = 'Sum([GS Month]) as [GS Mnth]'
                        visualContentObject.RowAxis.Expression = '<[BRAND] as [Brand Category] NEST [MARKET] as [Market]>'
                        visualContentObject.ColumnAxis.Expression = '<[Axis.Default.Names] as [Measure Names]>'
                        visualContentObject.ShowColumnGrandTotal = True
                        visualContentObject.ShowColumnSubtotals = True
                        visualContentObject.ShowRowGrandTotal = False
                        visualContentObject.Title = 'Monthly GS by Brand, Market'
                        visualContentObject.Data.WhereClauseExpression = '[NAME] = "CANADA"'
                        visualContentObject.CellWidth = 125
                        Document.Properties['cannedReportHideRows'] = 'Sum(Abs(SN([GS Month],0)))'
                    elif Document.Properties['cannedKPISelected'] == 'GS' and Document.Properties['cannedTimeSelected'] == 'Quarter' and percentageNeeded == 'Y':
                        visualContentObject = viz.As[VisualContent]()
                        visualContentObject.MeasureAxis.Expression = 'Sum([GS Quarter]) as [GS Qtr]'
                        visualContentObject.RowAxis.Expression = '<[BRAND] as [Brand] NEST [MARKET] as [Market]>'
                        visualContentObject.ColumnAxis.Expression = '<[Axis.Default.Names] as [Measure Names]>'
                        visualContentObject.ShowColumnGrandTotal = True
                        visualContentObject.ShowColumnSubtotals = True
                        visualContentObject.ShowRowGrandTotal = False
                        visualContentObject.Title = 'Quarterly GS by Brand, Market'
                        visualContentObject.Data.WhereClauseExpression = '[NAME] = "CANADA"'
                        visualContentObject.CellWidth = 125
                        Document.Properties['cannedReportHideRows'] = 'Sum(Abs(SN([GS Quarter],0)))'

So on and so forth.

This script (and others) run perfectly fine in the client. It does not run in the web. The web will say processing, then say ready (in the bottom left corner), all while doing nothing (no error, nothing). A few other scripts that I have in the same analysis run perfectly fine.

I know there are some limitations on IPython scripts on the web for security reasons, but I am only building a table. This cant be restricted can it?

We are on Spotfire 7.6

2 Comments

The web player logs do not appear to be capturing any errors. As far as uploading something, I would have to recteate most of this as it is somewhat confidential data. I would have to mock up a report. I will do that if there is nothing else left to try.

mpir - Aug 07, 2017 - 1:27pm ::

Hello,

Do you see anything in the Web Player log? Looking at the script ,it should work on the Web Player as well.Would it be possible to share the embedded dxp with the script? One other way would be to iteratively add the script and see where it breaks on the Web Player.

Sayali Patil - Aug 07, 2017 - 1:25pm ::
+ Add a Comment

(2) Answers

Login