Search code examples
ironpythonspotfire

How can checkbox filter be set with IronPython in Spotfire?


I have a column that is set as a checkbox filter which has two values ("Refund" and "EMPTY"). I'd like to set that filter to have only the "Refund" box checked, but I can't find out how to set it.

How is this done easily in IronPython?


Solution

  • Here's how I'm setting the checkbox filters. TOH to @Niko and @Jacek Sierajewski for the "(Empty)" hint for cb filter settings!

    from Spotfire.Dxp.Application import Filters as filters
    strTtype= Document.Properties['Ttype']
    FilterSelection = Document.Data.Filterings["Main Scheme"]
    cbfRefund = Document.FilteringSchemes[FilterSelection][Document.Data.Tables["Transaction Data"]]["Refund Transaction"].As[filters.CheckBoxFilter]()
    if strTtype=="Refund":
        for CheckBoxValue in cbfRefund.Values:
            cbfRefund.Uncheck(CheckBoxValue)
            if CheckBoxValue == "Refund":
                cbfRefund.Check(CheckBoxValue)
                cbfRefund.IncludeEmpty=False#This clears the "(Empty)" checkbox