Create unique reference code on entry

2 posts by 2 authors in: Forums > CMS Builder
Last Post: April 14, 2014   (RSS)

By zaba - April 14, 2014

Hi,

I need to create a unique reference code that is generated when a new record is added to a specific table in cmsb by the editor, the field auto populates with the code, can be something like OP-1, the numeric part of the code auto increments for each record added and is not editable. Is this achievable?

thanks

By Chris - April 14, 2014

Hi zaba,

The "num" field is available on every table and is already configured to be a unique, auto-incrementing field. It's also not editable. Would it work for you to output "OP-" then the num field?

OP-<?php echo htmlencode($myTableName['num']); ?>

All the best,
Chris