- Are you just learning how to use IronPython in Spotfire?
- Would you like to be able to toggle between Filtering Schemes but are worried about users breaking something?
Filtering schemes are extremely useful for changing multiple filters at one time. However, if many users are working with a single file, it’s very easy for a single user to alter something that shouldn’t be altered. This is when I like to use a filtering scheme drop-down property control in conjunction with an Iron Python script to toggle between filtering schemes and have the filtering schemes be left alone.
Filtering Scheme Example
In the example shown in the video, I have three filtering schemes — Well Group A, Well Group B, Well Group C – that have different wells selected in the filter panel. The video will follow the steps shown below, using the code that is below the steps.
- Create your filtering schemes.
- Add a text area to the page
- Toggle the text area into edit mode.
- Click the Add property control button and select drop-down list
- Click the New button to create a new property called FilteringSchemes using a string data type
- Select Fixed values in the Set property value through: drop down
- Under settings, in the Display Name, type – Julie’s wells, Amber’s wells, Kendra’s wells . This is what will show up in the drop down.
- Under Value, type – Well Group A, Well Group B, Well Group C. The case must match the filtering scheme exactly.
- Go to the FilteringScheme property, click the Script button.
- Set the radio button to Execute the script selected below:
- Click the New button and create a script called SchemeSelection
- Paste the script into the Script dialog
- Click the Add button and add a new Script Parameter MyFilterScheme.
- Note MyFilterScheme is part of the code that we just copied and pasted.
- Select String in the Type
- Set the radio button to Property and click the Select Property button
- Select the FilteringSchemes property just created
- Click OK
- Always click the Run Script button before exiting. That will tell you if the script is working. If you get errors, work through fixing. You may or may not be able to see the change if the script runs correctly, depending on what you have coded.
- Click OK, click OK and click OK
Here is a screenshot of the script so you can see what the spacing looks like.