RadioSaigon Posted April 27, 2016 Share Posted April 27, 2016 Greetings. New to the forum, using FMP14 on a Mac running Mavericks, FMP novice, aviation industry. Right... I think the best way to get to where I need to be is provide a little background: I'm working in what would politely be termed a 3rd World area -Papua in Indonesia, to be precise. There is not a lot in the way of structured organisation at a professional level here. I have developed (over the last 4 years or so) a database of navigational waypoints which we use here daily. I have sourced the data from a fairly diverse range of sources and now have a database that is really quite useful, after having undergone several structural changes as I have learned where the original data has come from, conventions that were used to build it and of course, proven the validity of the data myself before using it operationally. Therein lies the problem: Many organisations have contributed to the entirety I now have, with little-to-no consultation or cooperation between them. I have waypoint identifiers I have had to: 1. Record existing data and remove duplicates 2. Assign a unique identifier to each waypoint 3. Sort the existing (not necessarily unique) name into an appropriate field, where possible i.e. ICAO and/or IATA identifiers, or another field to contain the existing name where it fits no other field... this because many existing documents still refer to these "old" identifiers, so they still need to be stored and accessible when required. Then comes my problem: I have to be able to search them and pull up all the relevant information on the waypoint. I am often provided only partial information with a request for data, so unless I'm Very lucky, I wind-up executing anything up to a dozen Find's on 4 fields to get where I want to be! Frustrating and costing a Lot of time. I have over 900 waypoints recorded here now. What I would like to be able to do is: Execute a Script that will pop-up a box that I can enter the known search parameters into, then have it search the 4 fields for that string and return the results. Sounds pretty simple when you say it quickly ;-) I've spent a lot of time searching & trying whatever I could find, without success. Many "hot leads" have fizzled, having been suggested or written for versions earlier than 14. I'm far from expert in FMP or Script writing... but am able to follow simple instructions, as long as you type s l o w l y ;-) Many thanks in advance for any suggestions, tips or pointers -and thanks for your patience in reading this far ;-) Link to comment Share on other sites More sharing options...
AHunter3 Posted April 27, 2016 Share Posted April 27, 2016 I'm not sure I followed all that but I'm also not sure I need to. You have multiple fields. You EITHER want to find records that have some value that you type into your pop-up box in ANY of the four fields or else you want to find records that have that value in ALL of the four fields. I am mostly inclined to think you mean ANY (the first option). You'd do it like this, where g.SearchString is a globally stored text field: Set Field [YourTable::g.SearchString; ""] Show Custom Dialog ["Search for What?" enable field entry YourTable::g.SearchString / OK / Cancel] If [Get(LastMessageChoice) = 2] .. Exit Script End If Enter Find Mode [] Set Field [YourTable::Your First Field; YourTable::g.SearchString] New Record/Request Set Field [YourTable::Your Second Field; YourTable::g.SearchString] New Record/Request Set Field [YourTable::Your Third Field; YourTable::g.SearchString] New Record/Request Set Field [YourTable::Your Fourth Field; YourTable::g.SearchString] Set Error Capture [On] Perform Find [] Link to comment Share on other sites More sharing options...
Steve Martino Posted April 27, 2016 Share Posted April 27, 2016 (edited) I wonder if you just enable quick find on those four fields and use Perform Quick Find script step on the search string, if that would work for you. So if you had a global search field, and your 4 fields were the only fields with Enable Quick Find check, you would type into your global field and your script would be: Set Variable [$qf; Value: Get (ActiveFieldContents)] Perform Quick Find [$qf] You could fire the script from a script trigger (OnObjectExit) , or put a button next to the field with an eyeglass for example. Edited April 27, 2016 by Steve Martino additional info Link to comment Share on other sites More sharing options...
RadioSaigon Posted April 28, 2016 Author Share Posted April 28, 2016 Many thanks AHunter3. In my ignorance, I'm having trouble getting the Script Editor to accept some of the lines of code you've provided... I've got as far as Enter Find Mode [] done, but having trouble getting the 2nd field definition in for: Set Field [YourTable::Your First Field; YourTable::g.SearchString]. The dialog box won't allow me to add the gSearch field to the string! I'm sure it's something simple I've missed, but for the life of me can't see what it is! Would appreciate a heads-up. Regards Link to comment Share on other sites More sharing options...
RadioSaigon Posted April 28, 2016 Author Share Posted April 28, 2016 Many thanks Steve Martino -I hadn't realised the potential or flexibility of that search! Very handy. However, if in future I develop this as a stand-alone app, that functionality will not be available, yah? So I need to find/develop an appropriate search now? Link to comment Share on other sites More sharing options...
RadioSaigon Posted April 28, 2016 Author Share Posted April 28, 2016 AHunter3: please disregard previous -I've worked it out ;-) Seems to be working beautifully, many thanks! Link to comment Share on other sites More sharing options...
Recommended Posts