Include internal ID in detail view.

Status
Not open for further replies.

jeanl

Member
Hello

I have a basic inventory control system and I want to use the internal ID of each record to serve the purpose of "Order Number" because it increments and is not duplicated.

This works ok, but when I open the detail view of the record, the ID does not display. The other elements/records show, but this ID is somehow excluded. Can anyone assist?
 
I think it's hidden because it's only determined after save.
You can add a calc element displaying the id.

Or you can
edit your list, in "Advanced" set "Alter field types"=no
change the id to field, "Formatting": type integer,length 11; set hidden=no; no add and edit access;
 
Note that the problem with the calc approach is that the value won't exist in the database, until you've edited and saved the record. It won't exist on first submission. That's because the PK doesn't exist till after the row has been written, so the calc can't calc it. It'll show in list and details view, if you have "Only calc on save" set to No, but it's deriving the value on the fly, not getting it from the database. If you then edit and save, the PK will exist in thre submitted data, and it'll get written to the database.

It's usually best to create this kind of thing (a "serial" based on a PK value) with an 'onAfterProcess'PHP form submission script, which manually pokes the value into the database after the row has been written (and hence has an id / PK value).

-- hugh
 
Hello Hugh

Thank you for this detailed explanation. I appreciate it, and it makes perfect sense.

Jean
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top