Forum Discussion

RyanPersaud's avatar
RyanPersaud
Qrew Member
5 years ago

Creating A Unique ID

Hi All,

I was running into a problem in creating a Unique ID

The way we create a Unique ID in out business right now is as follows:

First 2 letters is the Region: PC=Pacific; PR=Prairies; EA=Eastern; MI=Michigan;
Next 4 numbers is the year: ie 2020;
Next 2 is the loss: Personal Workplace Injury=PI; Property Damage=PD; Vehicle Accident=VA; Environmental Loss=EV; Liability Claim=LI; Compliance=CO; Security=SC;
The Next two number is the month the loss happened ie January=01, February=02; the next 2 numbers is how many of that type of loss there was in that month;
Finally if the vehicle accident in February was the 4th vehicle accident in that region that month it would show 02-04

For a final product of EA-2020-VA-05-04

My Current script is as follows:

var text a=If([Location - Zone] = "Eastern","EA",
[Location - Zone]= "Michigan","MI",
[Location - Zone]= "Pacific","PC",
[Location - Zone]= "Prairies","PR","N/A");

var number b=Year([Date & Time of Incidient]);

var text c=If([Type of Loss]="Workplace Injury","PI",
[Type of Loss]="Property Damage","PD",
[Type of Loss]="Compliance","CO",
[Type of Loss]="Environmental","EV",
[Type of Loss]="Liability","LI",
[Type of Loss]="Sercurity","SC",
[Type of Loss]="Vehicle Accident","VA","N/A");

var number d=Month([Date & Time of Incidient]);
var number dOne=ToNumber(PadLeft(ToText($d),3,"0"));

var number e=???????


ToText ($a&"-"&$b&"-"&$c&"-"&$dOne&"-"&$e)

Can anyone help in in figuring out what I would need to do to finish the final argument?

Thanks in Advance!


------------------------------
Ryan Persaud
------------------------------
  • If you question is how to sting them together separated by a dash

    List("-", $a, $b, $c, $dOne, $e)

     you can choose any thing in those quotes as the separator character(s)

    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    mark.shnier@gmail.com
    ------------------------------
    • RyanPersaud's avatar
      RyanPersaud
      Qrew Member

      Hey Mark,

      Im trying to figure out how to do the last part ($e)

      So basically if it is the 4th [Type of Loss]="Property Damage","PD" in a month e = 04

      Thanks, 

      Ryan



      ------------------------------
      Ryan Persaud
      ------------------------------
      • MarkShnier__You's avatar
        MarkShnier__You
        Icon for Qrew Legend rankQrew Legend
        Are you asking how to format the 4 as 04 or how to calculate the 4.

        ------------------------------
        Mark Shnier (YQC)
        Quick Base Solution Provider
        Your Quick Base Coach
        http://QuickBaseCoach.com
        mark.shnier@gmail.com
        ------------------------------