7 years ago
3
Topic

Hello,

I would like to know if when saving form data to a custom table, it's possible to also save a custom ID instead of an au increment one. What I mean by that is could the row ID be something like <xx>-<xxxx>-<xxxxx>, where <xx> is something i would determine when the data is being saved.

Thank you for any help.

Get a Book for SEBLOD
4229 Posts
Kadministrator
7 years ago
2
Level 1

If you don't have autoincrement set on the table you should be able to insert any id you want or is it not working?

7 years ago
1
Level 2

Hello Klas,

What I'm trying to do insert a calculated ID. For instance in standard PHP once the form is filled out I would query the database, in order to have the number of records, and create an ID similar to code-year-records.

  • Code would be a fixed value
  • Year the current year
  • Records the number of lines in the table, with leading zeros.

I don't know how, using SEBLOD, I can create that kind of custom field that is dependent on other information (some of which come from a query).

I hope this brings more clarity as to what my difficulty is.

Thanks again for any help.

4229 Posts
Kadministrator
7 years ago
0
Level 3

Hi,

I think that only way to do this is to use beforeStore code plugin- with it's help you can manipulate existing data being sent to storage and do any necessary adjustments/inserts etc.

Get a VIP membership