swpowe Posted November 22, 2004 Posted November 22, 2004 I hope I'm in the right place...I'm using FMP ver7 and I'm trying to do two things. The first is, I've got a button that when clicks runs a script that does a simple search and returns all fields that match a specific criteria that is built into the script...instead of having the specific criteria say all fields that have the word "recorded" in them...I want to have that populated by a drop down list so i don't have to have a button for each report I can just have one button and a drop down that will allow me to select the variable I want to search for. Make sense? My next question is this. I also would like to have a button that would run a script that looks at a specific field and if that field name matches the name of a layout it would go to that layout but if there is not a layout by that name it would return a message saying such. I appreciate all the help I can get on this. Thanks!
transpower Posted November 22, 2004 Posted November 22, 2004 1. Add a field to the layout for the drop-down list. Have the script go to that field for the find. If you're OR'ing requests, then you'll have a have a new request with each relevant field being set to the value of the new field. 2. Go to Layout | by calculation (the field name), then add an If statement and custom dialog if no such layout.
Fitch Posted November 22, 2004 Posted November 22, 2004 Welcome to FM Forums. If I may make a suggestion, try to title your posts with descriptive titles if possible, e.g. "Scripting a Find" or "Scripting layout navigation." You may find you get more responses. I'll add one more option to your first question: if you want to save your users a click and/or specify the criteria before you start the search, use a global field for the popup list. Then your script would look like this: Enter Find Mode Set Field ( your search field, global popup field ) Perform Find I have simplified, assuming you will deal with error trapping etc. For the second question I'll add: turn Error Trapping On as the first step in your script. The next script step after go to layout would be: If( Get ( LastError ) = 105 ) etc. 105 is the "Layout is missing" error.
swpowe Posted December 1, 2004 Author Posted December 1, 2004 I don't think I have it setup right...forgive me for not having too much experiance with this. I created a script that looks like your script up above (for my find request) but i'm not sure how to search multiple fields and return any request that meets the global drop down value. Would I just duplicate the "set field" line and reference each of the 5 fields I want to search? For my original 2nd question..would you have an example of an if then statement I could use? I'm not too familiar with if then statements. Thanks!
-Queue- Posted December 1, 2004 Posted December 1, 2004 1. Yes, but you'll need to use New Record/Request between each Set Field step. This will allow you to do an OR find. 2. If [Position(
Recommended Posts
This topic is 7300 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