27
Views
1
Comments
How to get next available number from a range

Hello All,

I have 2 tables

1st table is having data like Name, Min and Max range

A 100 200

B 300 400

2nd table we have data like Name, Number, Remarks

I want was trying to get the next available number in the input box from range suppose if the range is 100-200

and we have data for numbers like 102,103,105 so the next available number is 104 then 106 and it should go till 200.

If I select B from drop down, it will take number 300, 301.


2019-04-09 00-57-55
carl ruhle

Hi,

one way to do, select the column is ascending order and get the first value. 

On a variable store that number plus 1.

Them loop thru the records and if the number of the loop is equal to the variable add again 1 to the variable. 

When you get where they are different and the value from the record is greater than the value in the variable you found the next available number. 

Hope that I could explain clearly, best regards. 

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.