I want to generate serial numbers like PP0012020, PP0022020, PP0032020 and store them on the database.
Must know
The serial number will change year-wise like for the year 2020 the serial number will be like PP0012020, PP0022020, PP0032020.
But,
For the year 2021, the serial number will be like PP0012021, PP0022021, PP0032021.
Want to store the same in the database and later show them on dynamic page for print.
Like this.
sorry, there is a mistake in the picture.
"PP = CONSTANT’’
You have just to implement the YEAR into this code, good luck 
var COUNTER = 0
$w.onReady(async function () {
$w('#myButton').onClick(()=>{
console.log(generateSerial())
})
});
function generateSerial(){
const prefix = "PP000"
let currentCount = (Number(COUNTER++)).toString()
let mySerial = prefix.substr(0, prefix.length-currentCount.length) + currentCount
return mySerial
}
You can test the CODE in the CONSOLE. (press F-12 in google-chrome and go to CONSOLE), or do the same in the PreviewMode of your Wix-Editor.
how generate alphanumeric random number