When sorting name or items, the default alphabetical sort is not always desirable. In any company, sorting items by usage or priority and sorting names by rank may be necessary. Software programs for this solution include ClarisWorks, Microsoft Works for DOS/Windows, Microsoft Access, Microsoft Word using tables, DB2, Oracle, and Sybase. Lotus Notes has the advantage here and you will see why!
A common solution to the sorting issue is to create a table in Microsoft Word and to add sorting numbers in front of the items or names. Then you perform a manual sort of each column. However, each new sort overwrites the old sort, so you must copy and paste sorts or perform the sort again every time. Lotus Notes provides a more appealing solution that does not give those priority numbers away by displaying them! Each sort is a different view that can be seen in the navigator pane and accessed when needed. Each view can be exported, concatenated, and printed. Choose File - Export and save type as Tabular Text. This stores the sort in a text file on your hard drive.
Let's use an example to illustrate how this solution works. As an Assistant Scout Master and a Computer merit badge councilor, I used Lotus Notes to create a troop roster that sorts by rank instead of alphabetically. The trick is to use a special default form formula to assign ranking numbers to a hidden first column in the By Rank view.
You can download the Scout Roster example from the Sandbox. The application is compatible with Lotus Notes 5 and later.
NOTE: This IBM/Lotus Scout Roster application meets the requirement for Scouting's computer merit badge 4a.
Download the sample application (there is a version 5 and 6 database to choose from) to your Notes data directory. See the Using This Database document for help, and then enter your scout data! Or follow this procedure to create your own application.
- Create a new database from a blank template.
- Create a simple form.
- Add three views to meet the requirements:
- Scout By Last Name (Alphabetically)
- Scout By Patrol
- Scout By Rank
- Enter scout data by creating documents.
Creating the new database and designing the form
For those who are new to Notes application development, refer to the Using This Database document for more detailed information about creating an application. For more experienced developers, follow the procedure below.
Create a new database in Domino Designer and create a form. Add the following text fields to the form:
Then add these fields for rank:
- SRank is a dialog list.
- SRankOrder is a hidden, computed number field.
Because the sort order is alphabetical, one way to deviate from this is to add a hidden, first column with ranking numbers. Each rank is assigned a number to display it in the proper order.
The field called SRank (Scout Rank) is a dialog list that shows a drop-down box selection in the document, containing all the scout ranks from which to choose. These names must be consistent for the formula in the application to work. The second field, SRankOrder, is a hidden, computed number field based upon the SRank field that generates the Sort Number data automatically.
Add the following @formula to the SRankOrder field to make it work.
@If(SRank = "Eagle";1;SRank = "Life";2;SRank = "Star";3;SRank = "1st Class";4;SRank = "2nd Class";5;SRank = "Tenderfoot";6;SRank = "Boy Scout";7;8)
You can add an Edit button to the form using
@Command([EditDocument]). Add a Save and Close button to the form with
Figure 1. Form
NOTE: Download the Scout Roster Flash demo from the Sandbox for application setup instructions.
Viewing the design
We used three views in our application: Scout By Last Name (Alphabetically), Scout By Patrol, and Scout By Rank. Design your three views to display the value of each field on the form. In the Scout By Rank view, we included a hidden, first column called RankOrder for the SRankOrder field.
Figure 2. Hidden column
For columns that users can see, we enabled column sorting with the "Click on column header to sort" property and using the Descending option.
To each view, we added a shared action button to create a document using this formula:
@Command([Compose]; ""; "<form name>"). See the Domino Designer Help for more information about creating and inserting shared actions.
Entering scout data
Last but not least, create documents in the application using the simple form. After completing the documents, open each view to see the different sorting solutions. The actual sort is performed on the hidden, first column so the rank is in the proper order.
Figure 3. Sort By Rank view shows rank order, but hides the ranking numbers
Figure 4. Sort By Patrol view shows categories and ascending order
Figure 5. Sort By LastName view shows alphabetical ascending order
As you can see Lotus Notes is not only a powerful way of easily viewing your sorted information in a local database but by hosting it on a Domino server, people within your organization can be assigned specific access privileges to view any or all of the data. Editors can be assigned to change the data and managers to manage who has access to the data.
NOTE: The sample application contains Boy Scout graphics that you can download from the Boy Scout Animated Graphics and Fonts Web site. The Scout Roster uses a frameset with an outline and pages to display more graphics. For more information about framesets, outlines, and other Domino design elements, refer to the Domino Designer Help.
- Refer to the Domino Designer Help for more information about Domino design elements and Notes application development.
- Download the sample application from the Sandbox.
- Download a trial version of Lotus Notes and Domino from the developerWorks: Lotus Downloads page.
- Get involved in the developerWorks community by participating in developerWorks blogs.
- Browse for books on these and other technical topics.
Dig deeper into IBM collaboration and social software on developerWorks
Get samples, articles, product docs, and community resources to help build, deploy, and manage your cloud apps.
Experiment with new directions in software development.
Software development in the cloud. Register today to create a project.
Evaluate IBM software and solutions, and transform challenges into opportunities.