Randy Posted December 3, 2001 Posted December 3, 2001 Hello, I have a client list that is displayed in list form. I have a couple of different sorts that allow me to change the display order. I'd like to be able to "jump" to a specified letter of the alphabet, rather than having to scroll throught the entire list. I've have created buttons that perform a find for a specifed letter, but I don't like that it destroys the sort order and omits the other records. I'd prefer to just "jump" down the currently displayed list as sorted. Any ideas...?? Thanks, Randy
BobWeaver Posted December 4, 2001 Posted December 4, 2001 Create these fields: cFirst - calculation(text) =Left(LastName,1) gPickLetter - global(text) cAlphabet - calculation(text)(unstored) ="ABCDEFGHIJKLMNOPQRSTUVWXYZ" Create a relationship called "FirstLetter" between gPickLetter and cFirst Create the following scripts: Jump code: Go to Related Record[FirstLetter] Scroll Window [pagedown] Scroll Window [To selection] Next code: Set Field [gPickLetter, Middle(cAlphabet,Min(26,Position(cAlphabet, gPickLetter,1,1)+1),1)] Perform Script [Jump] Previous code: Set Field [gPickLetter, Middle(cAlphabet,Max(1,Position(cAlphabet, gPickLetter,1,1)-1),1)] Perform Script [Jump] Assign the Previous and Next scripts to buttons with the same name. These will then skip ahead and back to the records where LastName begins with the relevant letter. This will give you a starting point. Since you are sorting in different ways, I assume that the list will not necessarily be in alphabetical order by Last Name. So, the way the scripts behave may require some tweaking.
Vaughan Posted December 4, 2001 Posted December 4, 2001 I've never done this, but you could try this: Make a field in each record with the letter in it -- "Letter". Make a global field with the search letter -- "LetterG" Create a script that does something like this: code: Go to Record/Request [first] Loop Exit Loop If [ Exact ( Lower(Letter), Lower(LetterG) ) ] Go to Record/Request [next, exit after last] End Loop This script starts at the first record and scrolls thrpough them until it finds a record where the letter matches the desired letter in LetterG. If no records match it finishes up on the last record. Of course a portal and a type-ahead system might look a bit better...
Steven H. Blackwell Posted December 4, 2001 Posted December 4, 2001 You can get carried away with this, but here is one method. We can create a calculated and stored text field called a multikey. It would be something like this, where "PP" is the paragraph character from the calc box: Left(LastName,1) &"PP"& Left(LastName,2) &"PP"& Left(LastName,3) &"PP"& Left(LastName,4) for the first 4 letters of the last name. If the last name were Smith, the resulting key would look like this: S Sm Smi Smit Now, define a global text field. Establish a relationship to the same file (a self join) with the global key on the left and the multikey on the right.Then have all records display in a portal. When you type "S" into that global field, all the records with a last name starting with "S" will appear, When you type "Sm" all the ones starting with "Sm" will appear. This can be slow if ther are a lot of records, but it is another way to do this. Old Advance Man
Randy Posted December 4, 2001 Author Posted December 4, 2001 Bob, You rock!! Your calculations and field combinations worked like a charm. Very slick solution, thanks!! Randy
Recommended Posts
This topic is 8395 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now