I have a list of consecutive jobs numbers that start every year.
The format is as follows:
2k19xxx
2k20xxx
2k21xxx
Description:
2k = code added in the year 2000
19, 20, or 21 - the year the job was started.
xxx = consecutive number from 001 to whatever number jobs are started that year
Right now, the “Jobs Schedule” is kept in a google sheet, and every year is kept in a separate tab - so creating the consecutive number codes is not a problem using a cell formula.
However, when using AppSheet I find it is more convenient to have all the jobs in a single sheet.
I am trying to use the following formula to auto create the job number:
“2K”&(Year(Today())) = 2k2021
Problems:
I need the year to be only 2 digits - and I am getting 4 .
I need to get a sequential number in 000 format after the year.
Do you have any advice on how to approach these two problems?
[Serial Numbers, If You Must](https://community.appsheet.com/t/serial-numbers-if-you-must/19325) Tips & Tricks ?
Danger Ahead! In general, sequential numeric identifiers (i.e., serial numbers) are risky in AppSheet: if two users happen to add rows at the same time, both rows could be assigned the same serial number, which could lead to confusion (at the least) or data loss (at the worst). For this reason, serial numbers are strongly discouraged! Basic Serial Numbers One way to implement serial numbers is with a normal (not virtual) column named (e.g.) Serial of type Number and an Initial value expression …
I think I understand the reason for the sequential number warning.
However, in this case only one person will be creating the job numbers.
Questions: (Regarding serial numbers using)
1-How can an initial value expression re-start every Jan 1st?
(That day is a holiday and there will not be any activity, or it may fall in the middle of a weekend )
2-Perhaps checking the value of the row above and the value of Today()?
(For some reason this does not sound very Appsheet like…)
Replace table with the name of the table that contains these values; and replace column (twice) with the name of the column that contains these values in that table.
SELECT(table[column], ...) gets the values in the column of the table from those rows that match the given condition (...; see (2)). See also SELECT()
STARTSWITH([column], ...) matches those rows with a column value that starts with the given text (...) that should match only the current year. See also STARTSWITH()
SORT(..., TRUE) sorts the results of (1) (...) in descending order (per TRUE), putting the most-recent-dated value first in the list. See also SORT()
ANY(...) extracts the first item from the list produced by (3) (...). See also ANY()
RIGHT(..., 3) extracts the three rightmost characters from the value given by (4) (...). See also RIGHT()
NUMBER(...) + 1 converts the value given by (5) (...) to a Number value and adds one to that. If (5) gave a blank result (because no value for this year has been used), NUMBER() will give 0, to which 1 will be added. See also NUMBER()
CONCATENATE("000", ...) creates a Text value from 000 followed by the result of (6) (...). This adds leading zeros to the numeric value from (6). See also CONCATENATE()
RIGHT(..., 3) gets the three rightmost characters from the value given by (7) (...). This ensures the value has only three digits by removing any excess leading zeros.
CONCATENATE(..., ...) produces the serial number of the desired format, consisting of the year in 2KYY format (the first ...), followed by a three-digit serial number distinct within that year from (8) (the second ...).