I recently came across some client reports that, when initially run with search criteria, looked correct and displayed properly. However, that all changed once a user selected pagination.
The search results soon began to look like nothing I’d searched for, and after a few clicks of Next and Back I could produce errors. When I drilled into the code, I found that the results were ordered by date, but the pagination used the ID of the record. Using the record ID would have been fine if we were only displaying a dump of the data and ordering it by ID, but to have a functioning useful report, this did not work.
I needed a way to order by any report column header, and for the pagination to keep intact the ordered by results as a user moved between the pages. After some quick research I came across the SQL Server function ROW_NUMBER(), used in conjunction with OVER(). This was exactly what was needed to accomplish the report column sorting and the pagination honoring the order throughout the pages.
The result: Users were now able to paginate results, as well as sort by column heading, making for a logical display.
Have you found any tips or tricks for search results?
Want to learn to code but just don’t know where to start?
Codecademy offers a great online interactive resource to begin learning a multitude of coding languages, including:
- Web Fundamentals (HTML, CSS)
Each interactive course is broken down into individual exercises where you use the built-in editor to write your code and output it in the interpreter. At the completion of the course exercises, you can complete a project that will tie all the elements learned in the individual exercises together.
Helpful features, such as a Q & A Forum, help you along the way. If you’re stumped or need a refresher of what a term means there is a Glossary for each programming language. And if you want a break from lessons to experiment with the code and concepts you are learning you can use the “Scratch Pad” which is a blank editor and interpreter to play around with.
To make things more entertaining you earn points for the number of exercises you complete and badges for completing courses, streaks for the number of days you did exercises, etc.
If you want to tie multiple code, concepts, and or languages together there are lessons to build projects and APIs.
It’s a great learning tool and best of all, it’s FREE!
What other great online learning tools have you discovered/used?