Jump to content

How to fix reset all filter except one filter in the text area


gurusai sankar

Recommended Posts

Hi All,

 

I want to fix the reset all filter except period ranage filter in text area i am using below script, first 3 tabs are working fine but 4th tab (Unmet demand is not working) , i have used the similar script for all. Please find attcahed dxp and help on this.

import Spotfire.Dxp.Application.Filters as filters

import Spotfire.Dxp.Application.Filters.ListBoxFilter

from Spotfire.Dxp.Application.Filters import FilterTypeIdentifiers

from Spotfire.Dxp.Data import DataPropertyClass

from System import String

myPanel = Document.ActivePageReference.FilterPanel

#REset Testcolumn form the first table

myFilter= myPanel.TableGroups[0].GetFilter("RESOURCE_POOL_REQUESTED")

lbFilter = myFilter.FilterReference.As[filters.ListBoxFilter]()

lbFilter.IncludeAllValues=False

lbFilter.Reset()

#REset Testcolumn form the first table

myFilter= myPanel.TableGroups[0].GetFilter("ROLENAME")

lbFilter = myFilter.FilterReference.As[filters.ListBoxFilter]()

lbFilter.IncludeAllValues=False

lbFilter.Reset()

#REset Testcolumn form the first table

myFilter= myPanel.TableGroups[0].GetFilter("PROJECT_NAME")

lbFilter = myFilter.FilterReference.As[filters.ListBoxFilter]()

lbFilter.IncludeAllValues=False

lbFilter.Reset()

#REset Testcolumn form the first table

myFilter= myPanel.TableGroups[0].GetFilter("PROGRAM_NAME")

lbFilter = myFilter.FilterReference.As[filters.ListBoxFilter]()

lbFilter.IncludeAllValues=False

lbFilter.Reset()

Link to comment
Share on other sites

You are looking for the filter RESOURCE_POOL_REQUESTED, but this lives in the second table group ofthat page (Information_link_Unment_Demand Month Level). So when you write:

myFilter= myPanel.TableGroups[0].GetFilter("RESOURCE_POOL_REQUESTED")

the table group you get is the first one appearing on your filter panel (Information_link_MONTHLY_CAPACITY_VIEW) which does not contain that filter and returns None.

Workarounds:

a) changeTableGroups[0] toTableGroups[1]

b) move up the desired table group in your filter panel for the affected page

c) write safer code to identify the correct table group and use it throughout, e.g.

pageGroups = myPanel.TableGroups

for tg in pageGroups:

print tg.Name

if tg.Name=='Information link_Unment Demand_Month level':

myTableGroup=tg

#REset Testcolumn form the first table

myFilter= myTableGroup.GetFilter("RESOURCE_POOL_REQUESTED")

lbFilter = myFilter.FilterReference.As[filters.ListBoxFilter]()

lbFilter.IncludeAllValues=False

lbFilter.Reset()

#..same for the other groups of statements

In general, running the Iron Python script within the editor window and putting print statements is a good debugging practice, so you can see where the error occurs and get an idea of the underlying problem.

Gaia

Link to comment
Share on other sites

  • 1 month later...

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...