I know this is unorthodox. Not even sure this is the correct forum.
I have an algorithm, I believe, that i am in need of. I'll try to explain.
The following number assignments will constantly change, so the formula needs to be able to adapt.
max = 50
I have three categories:
Local, National, International
Each will have a number assigned depending on a number of factors. So, for example. The *max* number above is the display on a page of the data in the three categories.
Now, if I am only allowed 50 per page and each of those categories can have *n* amount and must be in the order supplied: Local shows all of its content, then national, then international. When one cat is exhausted the next category continues.
Could have the remnants of one cat end, and one start up on the same page.
So,
max = 50
Local = 149,
National = 112,
International = 40
What would be the formula that which gives me the proper display request. I will have knowledge of the current page (page they request). We'll call that currPage.
(Local - (max x (currPage - 1)) / max >= 1 --> request 50 Local if true;
(Local - (max x (currPage - 1)) / max < 1 --> request the Modulus amount and then start into National
I am just at a loss here on how to construct this sort of display. This is a programatic sort of thing.
so, ultimately the display or logic would give me:
page 1:
Local = 50
page 2:
Local = 50
page 3:
Local = 49
National = 1
Page 4:
National = 50
Page 4:
National = 13
International = 37
Page 5:
International = 13


LinkBack URL
About LinkBacks