Forum Discussion

HarrisTse's avatar
HarrisTse
Qrew Member
2 months ago

Autogenerating Number

Hi guys,

I have a question for autogenerating number when I create a new record.

So I have 2 fields which are Reference and Type. Please see below photo:

"Type" is the multiple choices option which are shown below:

What I want to set up is when I select Prov Sum, the record will start from 1.01, 1.02 etc.

If I select Variation, the record will start from 2.01, 2.02 etc.

If I select Anticipated Variation, the record will start from 3.01,3.02 etc.

Every projects will be the same for the above sequence.

Currently, I am inputting manually. Is this something I can do it by formula or pipleline?

Thank you.  



------------------------------
Harris Tse
------------------------------

12 Replies

  • Your intent is to sequence them correct? So if this is the 5th 'Variation' then it should be 2.05? 

    Your best solution is to make sure that your 'Type' is it's own table. So the table would have your list of Types and then you create a relationship to whatever table is being used to select that and they're choosing the 'Related Type'. With that, you can summarize the # of records created for that 'Type' - add that field as a lookup and create the 'next reference number which would be lookup value + 1. Then using Pipelines when the record is saved, copy a formula field that you create the 'Next Reference Number' and move it into the manual field where it can stay stored permanently. 



    ------------------------------
    Chayce Duncan
    ------------------------------
    • HarrisTse's avatar
      HarrisTse
      Qrew Member

      Hi Chayce,

      Yes, my intention is to sequence them and the number will come up automatically.

      So I have 2 tables, one is "Project" and one is "Cost" which show each project cost records (PS, Variations, Anticipated Variations). "Project" is the parent table while "Cost" is the child table. Each project will have many cost records and I want the sequence like above.

      In this case, can I still do it in formula or pipeline?

      Thanks.



      ------------------------------
      Harris Tse
      ------------------------------
      • ChayceDuncan's avatar
        ChayceDuncan
        Qrew Captain

        Ah - if the sequence is specific to that one project and not a global sequencing then you'll have to go a different route. Best way is to make a formula query field that counts the # of records with the same type related to that same parent record where the Record ID# is less than the current record (basically how many came before it of the same type/parent) and create the sequence #. Then copy that value via Pipeline. 



        ------------------------------
        Chayce Duncan
        ------------------------------