Jump to content

how to perform search in a spotfire property control


Alina Tudor

Recommended Posts

I created this property where users can customize their report with columns of interest.

Given that there are over 200 searchable columns, is there any way to create a "search" type box where they can enter part of the column name and have all the options in the list displayed? That way it would be easier for the user to find the required column.

Thanks for help :)

Link to comment
Share on other sites

Hello,

There is an existing idea for that in the TIBCO Ideas Portal - "Search should be available in listbox property controls" (https://ideas.tibco.com/ideas/SPF-I-969) that I suggest that you vote for.

For something you could implement today, maybe take a look at "Add an autocomplete search bar to TIBCO Spotfire® using Text Areas

" (https://community.spotfire.com/s/article/add-autocomplete-search-bar-tibco-spotfirer-using-text-areas)

Link to comment
Share on other sites

Hello Alina,

I would have a solving solution for this topic but it is quite complicated in terms of a lot of steps but not necessary in terms of complexity. Now you will decide if is worth it or not.

The thing is that you can display this Document Property as a filter like any other normal filter containing column of your tables. To do there are necessary several steps.

  1. Using a R (TERR) function you can extract all column names (headers) of your table. So the ones you included in that doc prop. So your columns/headers will be stored in a new separate table. In this way you will be able to create a filter in the text area which will allow you to select like any normal filter but, more important, to search in it. The script R: output<-colnames(input) where output is a table (new table) and input is your existing table from which you take the columns/headers
  2. Using an IronPython script you will be able to store your filter selection into a new Document Property

from Spotfire.Dxp.Application.Filters import *

from Spotfire.Dxp.Data import *

 

filteringScheme = Document.FilteringSchemes[0]  #pay attention to your filtering schemes

dataTable = "TableName" #here put the new table name - where are all the columns names

filterCollection = filteringScheme[0]

 

activeFilter = filterCollection["ColumnName"] # which is the header of the new 1 column table - containing the column names

Document.Properties["newDocPropr"]= ((activeFilter.ToString()[(activeFilter.ToString().find(":"))+2:]).replace("(", "" )).replace(")", "" ) # in this new document property will be stored the selection that will be made in the filter. # what you see after "=" there are a lot of manipulation to get rid of some unuseful characters

3.Set a second R (TERR) function in order to trigger the script above.

y <- x

z <- Sys.time()

where:

y is an output parameter type value

z is an output parameter type value

x is an input parameter type value

Parameters:

x Expression (Count[Columns]), Limit by: Filtered rows: Filtering Scheme

y Document property - here you must create a new document property type integer

z Document property - here you must create a new document property type DateTime

4.Assign the ironpython script to your last new document property (type DateTime) in order to be triggered/executed each time the Sys.time() is changhing.

5.The last step is to adapt your graphic/cross table/whatever to your new document property (newDocPropr) the one where are stored all your filter selections. Here can be a little bit complex.

That's it ... I know that is complicated but it works ...

Daca ai nevoie de ajutor si vrei sa te asist, da-mi un semn si vorbim.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...