Set default record on RecordActionTable

I'm working on a module and I have a gateway webpage with a RecordActionTable component that keeps track of clients I'm interfacing with. I'd like to set one and only one as a default (so that I can retrieve a default client in my code) - is there an easy way to do this?

Another related question is I would like to force each client's Name to be unique when a new client is being created so that I could retrieve a client by name (sort of like how the SMTP Profiles on the Config section enforce this).

Both of these are probably properties that are added in the ConfigurationRecord that I don't know about.

If you aren't using an Ignition-controlled value as your primary key (like a device ID in the driver model), then you can arrange for one row to have the "magic" key value that represents your default.

IIRC, there's a column flag for that--S_UNIQUE I think.

Do you have an example of using a magic key value for the default?

I thought there was a Unique flag as well, but IntelliJ isn't bringing up any suggestions like it was for other flags:

I tried both SUNIQUE and S_UNIQUE and get the same error.

No, I've not had to do anything like that.

I dug around in my old stuff. It is a property, not a flag. Use it like this:

    static {
        SomeFieldMeta.putUserProperty(PersistentRecord.UNIQUE, Boolean.TRUE);
    }

StringField::setUnique does the same thing.

1 Like

Good to know for the future. I'm no longer using that bit of code I dug up, and no need expected.