Unofficial Spotfire Collection of Spotfire Script Snippets
How do i modify this script to use comma(,) as a separator instead of space?
Hello Sql Sean, Just pass the spearator you are using, in this case, a coma, as your argument to the split function.The split() function is converting the colname string to list of items a,b and c. The default separator is a space. If your original colname string is spearated by comas (e.g. "a,b,c"), then do: ...strVals.split(","))
Hello Jose,Can you provide te code if I have to make use of two list box filters instetad of a text filter and list box filter. I mean depending upon the selections made in the first list box filters, same should be filtered out in the second list box.ThanksBharath
Hello Bharath, Check out this postHope this helps.
This does not function if a value from the list pf specified values doe not exist in the drop down. Is there a way to resolve this? Appreciate your help.
Hello VD, you can select unique values from the filter into a list and do an intersection between the strVals from the doc prop and feed your setSelection with it:# Select unique values from the filter into a list # dt is a script param to your talbe as well as columnName (string)cursor = DataValueCursor.Create[str](dt.Columns[columnName])distinctRows = dt.GetDistinctRows(None,cursor)c1 = distinctRows.Reset()while distinctRows.MoveNext():c1.append(cursor.CurrentValue)# Do an intersection between the strVals # splits "a, b, c" by comma and remove spaces)c2 = map(str.strip,strVals.split(",")) c3 = c1 & c2# Feed your setSelection with itif c3.Count>0: lbFilter.SetSelection(c3)else: lbFilter.Reset()
Post a Comment