Skip to main content
Question

Ticket Number

  • April 6, 2020
  • 0 replies
  • 31 views

Hi,

How can I create a ticket no. based on Month-Day-Year and Record ID?

I already have a field name Date & Time Processed which shows 04-06-2020 6:19 PM.
with Record ID# 10

I want to see a ticket number that looks like this 0406202010

Can you help me create the correct formula?

Please advise.



------------------------------
Raymond
------------------------------
This topic has been closed for replies.

Forum|alt.badge.img+15
  • Registered
  • April 6, 2020
Raymond,

There is a trick to getting this to work right.  Quick Base counts months 1 to 12, therefore we have to force January to be 01 and not 1.  It is the same with the days of the month.

Create a Formula Text field.

Enter this as a the formula.  

var text NumMonth = If( Month(ToDate([Date & Time Processed]))<10, "0" & Month(ToDate([Date & Time Processed])), Month(ToDate([Date & Time Processed])) );

var text NumDay = If( Day(ToDate([Date & Time Processed]))<10, "0" & Day(ToDate([Date & Time Processed])), Day(ToDate([Date & Time Processed])) );

var text NumYear = ToText(Year(ToDate([Date & Time Processed]))) ;

var text NumRID = ToText([Record ID#]);

var text Ticket = $NumMonth & $NumDay & $NumYear & NumRID;

$Ticket


I did not test this so double check my parentheses for syntax error.
The first four lines create text variables for the components that make up your Ticket Number. 
The last var declaration puts them together in the order for your ticket.   
The final line will show the value of the variable Ticket in the Quick Base user interface.

Please reach back if there is problem.

------------------------------
Don Larson
Paasporter
Westlake OH
------------------------------