Chef Roy Posted March 14, 2007 Posted March 14, 2007 I have a list of records in Browse Mode (FM 8.5)and wish to create an A B C... listing on the footer so that when a user clicks on say... "C" the script will list immediately and moves to the first occurance of an Upper(Left([fieldname],1))="C" etc. etc. and redisplaying said records from the top of the screen. Would appreciate any ideas as I am still banging my head with some of the new elements of this version. Roy B
Lee Smith Posted March 15, 2007 Posted March 15, 2007 This is one of those things that has changed a lot. Left (YourField; 1) //Use your last name field for the YourField Your script will be something like: Set Error Capture [ On ] Enter Find Mode [ ] Set Field [ YourField; Get (ScriptParameter) ] Perform Find [ ] If [ Get (LastError) <> 0 ] Show Custom Dialog [ Title: "Warning"; Message: "No records found."; Buttons: “OK” ] Show All Records End If Next, attach the script to your buttons using the Script Parameter. Before v8, you would have to copy the script for each button. HTH Lee
Chef Roy Posted March 16, 2007 Author Posted March 16, 2007 Hello Lee; Thank you for the response however, being new to this, I am somewhat confused with the ScriptParameter area of: Set Field [ YourField; Get (ScriptParameter) ] If I have a footer menu... A - B - C.. Z, etc. and I attach the script to run on clicking say.. B, and the fact that you say you don't have to create a new script for each letter of the menu, how does the Perfom Find[] know which letter the user is clicking and to search for the first occurance of a Surname starting with the letter "B" ? Is there any simple learning aids or text out there that provides simpler explanations on how to use ScriptParams, etc. ? The help screens with FM 8 are written for people who know FM inside out. Regards, RB
mr_vodka Posted March 16, 2007 Posted March 16, 2007 Script parameters are basically values that you can pass along when your script is being called. You can typically pass a script parameter when assigning a script to a button or when you are calling a subscript from a script. In your button setup under the "specify script" section, there should be a 'Optional Script Parameter' entry box on the bottom. So for each button, pass the letter that you want as a parameter to the same script. i.e. First button "A", second button "B", etc etc. That way you will only need one script as Lee stated.
Lee Smith Posted March 16, 2007 Posted March 16, 2007 (edited) I can only add, The screen shot shows what we are saying, I hope. Note the "G" is where you will change the Script Parameter for each letter. HTH Lee Edited March 16, 2007 by Guest
Chef Roy Posted March 16, 2007 Author Posted March 16, 2007 Thank you Lee, now I get the drift, and it works. It displays however all records that contain the parameter (i.e. "G") within the fieldname chosen rather than displaying records where the parameter is equal only to the first letter of the fieldname. Any suggestions? Regards, Roy
Chef Roy Posted March 17, 2007 Author Posted March 17, 2007 Hello Lee; Marvelous what a little brain crunching does. I cured the problem... I created an ID_Alpa field that extracts the first letter of all surnames and placed that field in the SETFIELD search ScriptParameter. Works like a dream. Having said that I'm sure there's another way to do it without adding more resources to the file but I'm sure someone will advise me down the line. Many thanks. Chef Roy
Lee Smith Posted March 17, 2007 Posted March 17, 2007 Look at my first post again. [color:blue]Left (YourField; 1) //Use your last name field for the YourField I'm glad you got it figured out now. Feels good huh? Lee
Recommended Posts
This topic is 6463 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