Forum Discussion

WilliamHunter's avatar
WilliamHunter
Qrew Trainee
2 years ago

Random Pin Generator

I am trying to figure out a way if its possible to make a field that will generate a random four digit pin number. Is this possible in QB? 



------------------------------
William Hunter
------------------------------
  • One way is to have a pipeline

    {{ range(1, 2000) | random}}

    The other way is to try this 

    ToNumber(Right(ToText(Int([Record ID#]*9973/127)),4))



    ------------------------------
    Mark Shnier (Your Quickbase Coach)
    mark.shnier@gmail.com
    ------------------------------
    • joevandervest's avatar
      joevandervest
      Qrew Cadet

      Mark's pipeline sample works well, I use a version of it to send out random surveys on record save. Complete this with a check box/flag to record if you have already generated the pin or not.  e.g. pipeline would trigger on update, set the random pin to the jinja output, set the "it's already set" flag to TRUE and then end.  You'd trigger only on record update where the "it's already set" flag is false. 



      ------------------------------
      joe vandervest
      ------------------------------
      • WilliamHunter's avatar
        WilliamHunter
        Qrew Trainee

        Perfect thank you both!



        ------------------------------
        William Hunter
        ------------------------------