Posts

IronPython: Mark Rows, which are currently Filtered

When using the Data-On-Demand, there is a need, where you need to drive the on-demand data based on current selection. Below is helpful as you do not need to make your users Mark all Rows manually before proceeding to next steps. #=================================================# from Spotfire.Dxp.Data import * #Setup your Source Table below where the Filtered rows need to be captured tblName= "SalesAndMarketing" FiltScheme = "FilteredRows" MarkScheme = "Marking" #Gets Source Table reference dtRef=Document.Data.Tables[tblName] #Gets the Current Filtered Rows as per the filtering schema filtRows = Document.Data.Filterings[FiltScheme].GetSelection(dtRef).AsIndexSet() #Marks the rows as per the filtered Rows Document.Data.Markings[MarkScheme].SetSelection(RowSelection(filtRows), dtRef) #Do your table refreshes here Document.Data.Tables[ "Table1 to Refresh" ].refresh() Document.Data.Tables[ "Table2 to R...

IronPython: Get Unique values from Data Column

IronPython Script to extract the unique values from a Data Tables' Column. #-------Gets Unique values from a Column---------# def fnGetUniqueColVal (TblName,ColName):        #Get Table and Column References        dtRef=Document.Data.Tables[TblName]        ColCursor=DataValueCursor.CreateFormatted(dtRef.Columns[ColName])               fnUnique = ""        fnUniquearr = {}        for   row in  dtRef.GetRows(ColCursor):               rowIndex = row.Index               fnUniquearr[ColCursor.CurrentValue] = 1        for key, value in fnUniquearr.items() :        ...

Dynamic Column Filter Selections

Image
At times we have 10s or 100s of columns which can be potentially be used for filtering the data. We don't want to use the Filter panel for restriction and it is too cumbersome to provide all the filters in the Text Area. Well, we can use Document Property Selection along with Calculated Columns, to provide the user with ability to Filter on 100s of Columns based on their selection. Create a Dropdown Document Property tied to the Columns you want to expose for Filtering. Create Calculated Column, Tied to the Column Name selection in the Document Property Add the Document Property selection and Calculated Column in the Text Area for Dynamic Filtering. Final Result

Bootstrap Modal Window

Image
When there is a constraint of either Space or a need to force the User to make an selection before the Analysis is moved forward, it is useful to have a Modal Popup Window, show up. I am showing here how a Modal window can be created in Spotfire. It uses a hidden "Calculated Value" control in the text area to recreate a Spotfire filter in HTML + Bootstrap. Text Area HTML Content <!--Hidden Calculated Value variable for Content--> <div id="dropboxWrapper"  style = "display:none"><SpotfireControl id="582584011c584d9198f5c002603db718" /></div> <br> <br> <br> <h4>Presenting similar infomation in a nice Bootstrap presentation</h4> <br> <!--Jquery script adds content in below container--> <div class="container"> </div> Jquery Script //Append Header dependencies $('head').append("<link rel='stylesheet' href='https...

Dynamic Page Layout setup

Image
Sometime Spotfire layout is too crammed to see the chart content legibly and it helps to see the page in a different perspective. This can be achieved with the help of Bookmarks and Action Buttons Step 1: Capture bookmarks of different Screen Layouts that you want to present to user. You can resize charts to highlights the ones you want to stand out. ** Do not delete charts, as bookmarks will does not recreate it. Only Resize the layouts Step 2:  In a Text area, Create Action Buttons/Link/Image and tie them to the corresponding Bookmarks-"Page Layout and Visualization" element. ** Remember Bookmarks capture a lot more information (Filters, Marking etc..), we only want to apply the Layout settings. Step 3: That's it, you should be ready, test clicking on various buttons and see the screen layout change, giving importance to different charts as configured.