I have many - it depends on what your rules are for generating the name.
A really basic one is:
initial = firstname.charAt(0);
tempName = initial+surname;
MaxCounter = 999;
curNames = uselect("Select mskeyvalue from idmv_valink_basic where mskeyvalue LIKE 'tempName%'");
tempCurNames = "!!" + curNames + "";
if(!curNames.InStr("!!" + tempName + "!!"));
{
//tempName doesn't exist at all! We are good to go.
return tempName;
}
curNamesArray = curNames.Split("!!");
for(i=1; i < MaxCounter; i++)
{
if(!curNames.InStr("!!" + tempName + i + "!!"))
{
//tempNamei does not exist.
return tempName+i;
}
}
Handle errors here...
NOTE - this is very basic and not very efficient but it will work (debug my javascript first! )
Peter