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;
}
Access your files securely from anywhere
Zoho Developer Community
Deliver unforgettable customer experiences
Deliver unforgettable customer experiences
New to Zoho Marketing Plus?
Everything you need to run your marketing
New to Zoho Marketing Plus?
Everything you need to run your marketing
Zoho Desk Resources
-
Desk Community Learning Series
-
-
-
-
-
-
-
-
-
Zoho TeamInbox Resources
Zoho DataPrep Resources
Zoho CRM Plus Resources
Zoho Books Resources
Zoho Subscriptions Resources
Zoho Projects Resources
Zoho Sprints Resources
Qntrl Resources
Zoho Creator Resources
Zoho Campaigns Resources
Zoho CRM Resources
Zoho Show Resources
Writer Get Started. Write Away!
Writer is a powerful online word processor, designed for collaborative work.