Ignition Module / Dataset

We are trying to develop ignition module that will include only datasets. These datasets can then be assigned to any component such as a table and should be able to refresh automatically as the data changes.

Do you have any example or can you point us to converting business logic queries (datasets) to modules and can be auto refreshed based on the component’s (table, or chart) refresh properties that the dataset is attached to.

I think your best bet will be to hook into the extensible binding system.

These are the bindings that comes up under Other > Functions on the binding window. They usually (always) return Datasets, just like you wanted.

Check out the BindingType and the VisionClientInterface classes in the vision API.

We are trying to develop additional functions selectable as part of the “other” for components such as tables and charts which use datasets.

do you have any code example for how to bind. We looked at the VisionClient API as you suggested and did find the Binding Type as well as binding parameters etc.

Our problem is as follows (not actual code, just a conceptual representation of our problem):

function getmachinedata (var_machineid)
{Select * from table where machineid=var_machineid
return dataset}

Machine id will be assigned to selected item value of dropdown which will show all our machines.

It will be nice if you have any example that can demonstrate this. This is a very simple case, we can build complex datasets using this example.

I am assuming we have to use BindingType as our function name; where do we link the parameters of the function.

Thanks a lot.

I don’t think we have any example code for using the extensible binding system, let me see if I can help you along a bit.

First of all, you should implement this in part of your module that gets packaged up for scope “CD”(Client + Designer) scope.

The root of it all will be your implementation of [tt]BindingType[/tt]. This class will both describe your binding function to the designer so that it can be configured, and will execute the binding when needed in the client.

The Javadocs on that class are fairly complete, so I won’t go over each function in detail.

There are the three functions that provide resource keys that will be used to identify describe the function. The title and category must be keys that exist in a .properties file that you’ve loaded during your module’s startup function. (see [tt]BundleUtil[/tt])

The [tt]getParameters()[/tt] function is the key to setting up the parameters for binding. This function returns a list of [tt]BindingParameter[/tt] instances, which describe each parameter your function expects to receive upon execute. There are a number of functions on this interface that help describe the parameter, its type, and ways to select values (freeform value, choice list, tree browser, etc).

And of course the most important part of a [tt]BindingType[/tt] is the [tt]execute[/tt] function, which is what actually needs to calculate the Dataset that you’d like to return.

Hopefully this gets you guys started.

We tried but are not getting anywhere and still confused; is it possible to request an example function that will have one parameter; call a database; return a dataset using this extensible system.

What part is giving you trouble?

Dear Carl,

Please find the enclosed attachment for our client project code (3 Java, 1 properties file) and module.xml file where we are defining the scope.

Let us know if you need any other information.
Playground_Client (2).zip (9.72 KB)

The module is getting built successfully. However, we are not able to see the Function in Ignition Designer Binding Functions List.

We had a look at System Console. We had messages like Module Started etc. However, No error messages.

Your module.xml file specifies three hook classes: one each for designer, client and gateway, but the desginer and gateway hook classes don’t actually exist in what you sent me.

You need a Designer hook (it will look very similar to your client hook) that adds the MachineNameBinding in the Designer as well as the client.

Also, you don’t need a gateway hook at all for the extensible binding system.

Thank you Carl. We made required modifications and able to see the Function in Designer. As per our understanding, We need to make the Functions or Libraries to be Designer, Client scope. Since, the functions binded components are showing error in Client Browser.

You need to compile two separate jars, one for client scope, and one for designer scope.

The BindingType implementation and client hook goes in the client scope jar.

The designer hook goes in the designer scope jar.