Calling Extension function of a Vision component

I am using Ignition v8.1.17 and Sepasoft SPC module (v3.81.5 SP1). I want to filter sample definition based on the selection of the Location. Sample Definition Manager component has a filterSampleDefinition extension function which returns the filtered list but it runs only when the window containing it is opened. I want to provide the option to filter list on other event like button click, dropdown option selection etc.
Is there any way to refresh component to call this extension function? This method could potentially be used for other components as well.

If you need to write something that will be called in multiple spots or components, write your script in your project scripting library, and then call it from the appropriate extension functions. That’s for the code duplication part/being able to use it in other components.

Not sure what you mean regarding refreshing the component.

By refresh I mean making the component to call the extension function similar to way it does when window containing the component is opened. I am not sure if the arguments (their value) passed to the extension function by component can be obtained/created outside of the component. It might be possible to use some other functions and create these arguments but there is no property on the component which I can write the resultant filtered list to.
Instead if it is possible to trigger the call to the extension function (or rather making component to call extension function as one of the arguments is component itself), it would make it easier.

You can try system.db.refresh(), but as this is a Sepasoft component, you may have better luck asking them if if that doesn’t work.


I could not use system.db.refresh() since it requires the property name as one of the arguments and works for properties with DB bindings. For above component no property name is available that can be used for the extension function.

Since many Vision components have extension functions I was thinking there might be some way to trigger the extension function which will be applicable to any such component.

From javadocs, I found that there is startupComponent method that reloads the component making it to call the extension function. I tested below code on button click and it is working for above mentioned component. I think it should work for other Ignition/Sepasoft components having extension functions.

comp = event.source.parent.getComponent(‘SPC Sample Definition Manager’)
appContext = comp.getAppContext()

I have enabled only one extension function out of 3 available functions.

No, it works for any property binding. Most components will refresh if any bindable property changes. Consider adding a custom property that you can toggle just to see if that will trigger it.


You are correct. In fact it is mentioned in the manual as well. But from the code snippet which shows the example of data property of Table component being updated, I jumped to conclusion too quickly :grimacing:

I created a custom property on component which is bound to location selector as I want to filter definitions list based on this selection. Value change in this property doesn’t seem to be calling extension function as there is no change in the sample definition list.

I also tried calling refresh function on change of this property’s value. It’s printing the value of property but the print statement in the extension function is not printing anything.

if event.propertyName == 'SelectedLocation':
     print event.source.SelectedLocation
     system.db.refresh(event.source, 'SelectedLocation')

I never knew this! Sometimes testing is better than RTFM.