Either SORT RANGE is broken or I am an idiot

Either SORT RANGE is broken or I am an idiot

This issue has been fixed!.... Dated 6-18-09




Ok, 99.9% of the time any problems a user is having can be explained by user error or incorrect scripting

However, recently all of my app users have been complaining that the HTML page pagination in the app I built for them is completely wrong.

The pagination simply does a for each collection with a sort range of 0 to 35 then 35 to 70

I tested this hundreds of times before adding to the marketplace. And the weirdest thing is that Harsha helped me build it! He built it perfectly and there were no issues when I published to the marketplace nor have I republished.


Now, I just thought this was my fault so I delved into my DS. I spent the last 12 hours looking for the problem and I just couldn't find it!!

I started messing around and trying to isolate the issue..


In the wiki:

6. How can I fetch records within a given range?


 rec  =  Contact  [ID != 0] sort by  Added_Time  range from 1 to 5;

My test function code:




int test.test_count(int start, int end, int position)
{
rep_count = 0;
rep_list = List();
for each r in new_form [ID != 0] sort by first_name range from input.start to input.end
{
rep_count = (rep_count + 1);
rep_list.add(r.first_name);
}
info (("first_name in position" + input.position + " is " + rep_list.get(input.position)) + " then the list=") + rep_list;
return rep_count;}










}

I swear there is a problem with the range argument in the fetch record system.

However, I WANT TO BE WRONG. PLEASE TELL ME. WHAT I AM DOING WRONG.



I tested 3 different applications in 3 different accounts with many many different collection fields and sort ranges.

LINK TO A PUBLIC APPLICATION FOR TESTING...







In this test application there are 44 records in a form with a field called first_name

For the script above I enter the arguments....

start = 1
end = 2
position = 0

Result:

Executed Successfully
Return Value:
2
Log messages:
first_name in position0 is Aaron Foresman then the list=Aaron Foresman, Alishia Williams

-------------------------------------------------------------------------------------
start = 1
end = 5
position = 0

Executed Successfully
Return Value:
5
Log messages:
first_name in position0 is Aaron Foresman then the list=Aaron Foresman, Alishia Williams, Alison Case, Brian Raymond, Bruce Woodall

-------------------------------------------------------------------------------------
start=5
end = 10
position= 0

Executed Successfully
Return Value:
2
Log messages:
first_name in position0 is Chris Gehring then the list=Chris Gehring, Dale Winterfield

This returns only two people! and Chris Gehring is in 9th place not 5th.

Ok, everyone paint me an idiot.

Thanks..