# Creates multiple instances of records

**URL:** <https://forum.inductiveautomation.com/t/creates-multiple-instances-of-records/36903>\
**Category:** Module Development\
**Tags:** ignition80\
**Created:** [July 21, 2020, 3:09pm UTC](https://forum.inductiveautomation.com/t/creates-multiple-instances-of-records/36903 "2020-07-21T15:09:27Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![aimee.banmber](https://avatars.discourse-cdn.com/v4/letter/a/ed655f/32.png) [@aimee.banmber](https://forum.inductiveautomation.com/u/aimee.banmber)\
**Post date:** [July 21, 2020, 3:09pm UTC](https://forum.inductiveautomation.com/t/creates-multiple-instances-of-records/36903/1 "2020-07-21T15:09:28Z")

</div>

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):

 ![Screenshot from 2020-07-21 17-06-23](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/8/a8bc7e2bed41dd20f3e3a7ba89bbf0d3e0b38982.png)

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

 ![Screenshot from 2020-07-21 17-06-32](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/5/756749ebb4cf1ee819469f105349b87a1ecd4a4e.png)

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?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [July 21, 2020, 3:11pm UTC](https://forum.inductiveautomation.com/t/creates-multiple-instances-of-records/36903/2 "2020-07-21T15:11:48Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [July 21, 2020, 3:51pm UTC](https://forum.inductiveautomation.com/t/creates-multiple-instances-of-records/36903/3 "2020-07-21T15:51:14Z")

</div>

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:

> <https://github.com/paul-griffith/secret-keeper/blob/master/secret-keeper-gateway/src/main/java/com/griffithindustries/secrets/SecretKeeper/web/SKSettingsPage.java>

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

> <https://github.com/inductiveautomation/ignition-sdk-examples/blob/master/gateway-webpage/gateway-webpage-gateway/src/main/java/com/inductiveautomation/ignition/examples/hce/web/HCSettingsPage.java>

---

<div class="post-metadata">

**Author:** ![aimee.banmber](https://avatars.discourse-cdn.com/v4/letter/a/ed655f/32.png) [@aimee.banmber](https://forum.inductiveautomation.com/u/aimee.banmber)\
**Post date:** [July 23, 2020, 8:10am UTC](https://forum.inductiveautomation.com/t/creates-multiple-instances-of-records/36903/4 "2020-07-23T08:10:34Z")

</div>

Hey @paul-griffith, 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.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [July 23, 2020, 2:40pm UTC](https://forum.inductiveautomation.com/t/creates-multiple-instances-of-records/36903/5 "2020-07-23T14:40:28Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![aimee.banmber](https://avatars.discourse-cdn.com/v4/letter/a/ed655f/32.png) [@aimee.banmber](https://forum.inductiveautomation.com/u/aimee.banmber)\
**Post date:** [July 23, 2020, 3:17pm UTC](https://forum.inductiveautomation.com/t/creates-multiple-instances-of-records/36903/6 "2020-07-23T15:17:31Z")

</div>

That was it, thank you very much for your help 🙂
