Sequence with leading zeros

Hello Community,

I would like to create a sequence with leading zeros. For example 0000001 instead of 1.

Is that possible?

Kind regards,
Holger

Well, sequences in Clover are numbers, what you are describing is a string representation. You might use function like this to format your sequence number to format you described:

function string formatNum(integer num){
	string fmstr=toString(num);
	return left("00000000",8-length(fmstr))+fmstr;
}

Usage:


formatNum(3);
formatNum(3333);
formatNum(123456);

Hope it helps.

Hello,

thank you very much! It’s perfect!

Kind regards,
Holger