Preview:
getitmid = Item_Master[ID != null] sort by Item_Code desc;
if(getitmid.count() == 0)
{
	input.Item_Code = "ITM001";
}
else
{
	var1 = getitmid.Item_Code.getsuffix("ITM");
	if(var1.isEmpty() || !var1.isNumber())
	{
		var2 = 1;
	}
	else
	{
		var2 = var1.tolong() + 1;
	}
	autoList = var2.toString().length();
	accList = {1:"ITM00",2:"ITM0",3:"ITM"};
	input.Item_Code = accList.get(autoList) + var2;
}
disable Item_Code;
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter