Sorting problem

Hi,We have a code that has been deployed in live which will create a report district wise.We have that code worked properly on Dev server.When we have moved the same to live its not working as required. For example, there are districts D1,Districts D2,D3,D4 etc. While generating report they display in sequential order, when generated in dev.But the same code on production server,the order of the generated report is not generated in sorting order.D4 comes first,D2 comes next,D1, and D3 so on…The sorting is missing .No able to understand the exact problem why its happening like that.Any suggestions is appreciated.

Subject: Sorting problem

Show us the code. Where is the sorting applied? In a view? Is that view then used to generate the report? If so how?

It sounds like you may be creating the report from a view that is not sorted, it just displays the documents in the order they were created.

In your development database you probably created D1, D2, D3 and D4 in that order, while they were created in a different order in production.

How do you move the code from development to production? Did you develop it in a template, applied it to the database in the development and tested it until it was correct, then replace the design of the production database with the same template?

Subject: RE: Sorting problem

“It’s actually unsorted” is the most likely answer. Document collections (other than those produced by a search and ordered by relevance) are described in the documentation as being “unsorted”, but they’re usually ordered by NoteID because that’s the order in which they appear in the database. When you’re working with mock data, it’s easy to create a situation that is HIGHLY unlikely to occur with real data.

The easy way out is to create a view or folder that sorts the way you want. That will let you sort on various data types without worrying about conversions or data lengths. If the document count will fit into an integer without overflow, you can also create a proxy (or “companion”) array containing (usually) string representations of the data you want to sort on, and make sure that when you sort on the proxy array, the same swaps happen in the document array - but then you need to worry about left-padding the data, choosing a length for each data chunk that won’t either truncate the data or waste memory and slow down the sort, etc. All in all, a folder (or view) is a whole lot easier.

Subject: Could be the code

But as none of us can see your code we can’t say for sure.

It could also be related to the date format on the server, depends on what the code is sorting exactly.

From the information you have provided it could be the code it could be the configuration. You’re going to have to post more information.