Creates multiple instances of records

Hello,

I’ve been working on module development since recently, I manage to create easily almost anything I need except one thing.

For now, my modules use IConfigTab to add a new category under the left config panel to be set. My problem is by doing that, I am only able to keep one record at a time (as it upgrades the previous one by pressing “Save changes”) and create only one “instance” of my module. I was wondering if it’s possible to add a panel like this one (this is from one of Cirrus Link Ignition Module to use MQTT):

And then have another page to add the settings by clicking on the “Create new …” link:

I just want to be able to run multiple workers that have different settings. I know this is possible to do by looking at these modules, but can’t find any example.

After looking into the javadoc, I didn’t find anything really explained that could help.

Thanks in advance for your help!

PS: I know that I could create a driver module that could instantiate multiple devices, but I don’t think it is really appropriate, no?

These pages are likely all subclasses of com.inductiveautomation.ignition.gateway.web.components.RecordActionTable, though I’m not sure if there are any examples of this right now.

1 Like

The overview page, where you see the descriptive fields from the PersistentRecord and have the edit/delete buttons, is (probably) a RecordActionTable, as Kevin points out. There’s an example of one here:

The RecordActionTable automatically creates a RecordEditForm when you select edit, or you can manually create one:

1 Like

Hey @PGriffith, thanks for the really quick response. Indeed, that’s exactly what I was looking for!

There is still something that I can’t really understand tho, when I try to add a new entry, I’m getting an error message:

Executing INSERT INTO althellogateway (althellogateway_ID, Name) VALUES (?, ?) for [AltSettingsRecord 1 NewRecord Dirty0]

With the following error in the logs:

Caused by: org.sqlite.SQLiteException: [SQLITE_CONSTRAINT_PRIMARYKEY] A PRIMARY KEY constraint failed (UNIQUE constraint failed: ALTHELLOGATEWAY.ALTHELLOGATEWAY_ID)

I tried many things and even after following exactly what is written in the Secret Keeper example, but I don’t understand where the ID is handled.

The ID should be handled automatically by the IdentityField(s) in your PersistentRecord implementation - it’s possible some of your modifications left your table in an undesirable state. Try starting from a fresh config.idb, or at least dropping your module’s table and starting fresh.

1 Like

That was it, thank you very much for your help :slight_smile:

1 Like