auto increment with prefix

leon14

New Member
Hello,

I need your expertise. I created my table and its perfectly fine but i need a reference number where there is prefix and will auto increment like this

SRO&M-16-0001
SRO&M-16-0002
SRO&M-16-0003

and so on....
 
I believe that there is a new element type Sequence which is aimed at this sort of need. But never used it myself and not quite sure of its status.
 
Yup, I added it a few months ago. There's no download ZIP for it yet (that'll happen in the next release), but if you do a full github update, you can then "Discover" and install it in J!'s extension manager.

It does exactly what you want. It has three different modes, which the tooltips on the element settings explain. In short ...

Form load mode ... this creates the sequence number when the form is loaded, so the number is visible (read only) on the form. However, you can end up with gaps in your sequence numbering, if someone loads the form but never submits it.

Form submit mode -... this creates the sequence number during form submission. This avoids gaps in the sequence, but means the sequence number is not available on the form before saving.

PK mode - in both of the above modes, the sequence number is unrelated to the primary key (PK, rowid) of the form, rather it is maintained in a special Fabrik metadata table. In PK mode, we use the rowid of the form as the numeric part of the sequence.

In all modes you can define whether the affix comes before (prefix) or after (suffix) the number. And you can use either static strings or element placeholders for the affix. So for instance if you wanted to include (say) the year as part of the sequence (XYZ-2017-0001), and you have an element on the form for the year, {yourtable___year}, your affix would be "XYZ-{yourtable___year}". And you can optionally have your sequence numbers roll back to the start value if the affix changes (so XYZ-2018 would start over).

-- hugh
 
I loaded up the element 3.8.1 , but I am getting an error "Table 'bitnami_joomla.#__fabrik_sequences' doesn't exist"
Did I miss a step?

I have tried the options 'on load' and 'on submit' and both give the same result. I tried 'use PK' and all values are 00 (eg INV00 irrespective of the PK)
 
Last edited:
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top