Find next available integer in sorted list
I have a custom function that finds a next available integer and creates a part number. The function currently takes a sorted list and loops through each item to find the missing number in sequence. On some part numbers I run into an issue where statement limitations exceed max because the list can have up to 9999 possible items. Is anyone aware of any creative ways to rewrite this function without a loop?
list.sort();
nextAvailable = 0;
for each num in list
{
if(num != nextAvailable)
{
break;
}
nextAvailable = nextAvailable + 1;
}
Zoho Desk Resources
-
Desk Community Learning Series
-
-
-
-
-
-
-
-
-
Zoho CRM Plus Resources
Zoho Books Resources
Zoho Subscriptions Resources
Zoho Projects Resources
Zoho Sprints Resources
Zoho Orchestly Resources
Zoho Creator Resources
Zoho WorkDrive Resources
Zoho Campaigns Resources
Zoho CRM Resources
Writer Get Started. Write Away!
Writer is a powerful online word processor, designed for collaborative work.