1. We suggest you do NOT update to Joomla 3.8.10 until we can resolve an issue it causes with caching in Fabrik. If you do install it, you'll need to disable Joomla's "System Cache" in the global System settings.
  2. Apologies for the recent server outage, a planned migration by our host provider to a new location turned into a bit of a nightmare.

Sequence element

May 7, 2018
Sequence element
  • The sequence element is useful for generating a formatted sequence number, optionally independent of the Primary Key (PK) of the form. For example, INV0001 for invoices.


    Settings(top)


    sequence.png
    • Affix Position - should the affix you specify be a prefix or suffix (like SKU0001 or 0123-SKU)
    • Affix - the string to prefix or suffix the sequence number with. Can either be a fixed string (like SKU or INV, etc), or can use {table___element} placeholders. For example, if you want to use a dropdown menu with the year to use as the affix, you might specify "{yourtable___year}-" to generate sequences like "2017-0001".

      Note: that the plugin maintains separate sequences for each affix used. So if your year changes to 2018, the sequencing will start from the beginning.
    • Method - choice of 3 methods:
      • On Load - the sequence number will be generated as the form loads. This means the sequence can be seen when creating the form, but you will get gaps in the sequence if someone loads a form but never submits it, and you can't use element placeholders in the affix (as element don't have values when you load a new form).
      • On Submit - the sequence is generated during form submission, so no gaps, but it can't be seen when creating the form.
      • Use PK - in this mode, the row's Primary Key is used as the sequence number, rather than maintaining a separate one for this element. Will ignore any "Start" value, and won't maintain a separate sequence for different affixes.
    • Start - the value to start the sequence at, ignored by the "Use PK" method, defaults to 1.
    • Padding - the 0 padded size of the sequence number, like "0001", defaults to 4.

    Notes(top)

    The first time you select this element type, it will create a new metadata table, #__fabrik_sequences, which is used to track the sequence numbering by table name (the database table associated with the form), element ID and affix.

    As it uses table name, rather than form/list ID, if you have copies of a list/form, the sequence same sequence will be used in all copies.

    This plugin does NOT work for in repeated or joined groups. It is designed only to work for an element on the main form, in a non-repeated group.

    Uses(top)

    1. Let us assume you have Client White Tiger ({tablename___client_name}) and you want to add first alphabet Affix to the Sequence Element. For eg. WT-001.

    Add following code to the Calc Element {tablename___client_affix}):
    Code (Text):
    $words = preg_split('/\s+/', '{table_name___client_name_raw}');
    $acronym = "";
    foreach ($words as $w) {
        $acronym .= $w[0];
    }
    return $acronym;
    Then add / prepend {tablename___client_affix} this in 'Affix' field of Sequence Element.
  • Loading...
peppe10 and merlino68 like this.