Newbies fmousaev Posted November 16, 2002 Newbies Share Posted November 16, 2002 I am making a database in filemaker and i've got 3 files for three different tables which will be related. In one of the files there will be a welcome page layout and in there i want to put a search button. Now what i want this button to do is that when a user clicks it I want the message to come up asking him in which of three tables does he want to perform a search in. I don't know how to do it, so can someone here please help me with this problem Link to comment Share on other sites More sharing options...
spb Posted November 16, 2002 Share Posted November 16, 2002 This might be a bit clumsy, but it could work. When the user clicks the button, instead of a message coming up, they are taken to a layout that contains the message, plus a set of three radio buttons labeled for your three tables (say, A, B & C), and a global field into which they enter their search criteria. They click a button for the table they need, enter the search criteria, then click a "go" button. You'd then have a script that copies the contents of the global field, then runs one of three external scripts, depending on a Case conditional referring to the radio buttons. There's a script in each of the three tables being called. These scripts will go to the appropriate layout, enter Find mode, set whichever fields necessary with the previously copied global field (this way your user can search across many fields at once, if you just keep adding New Request, Set next field to global statements) then run the Find. Depending on what you want your user to do at this point, you can either insert a pause in the script, followed by a clean-up (run external that takes you back where you started & empties the global) or if they need to do a bunch of stuff, include a "Home" button somewhere that runs the external taking them back and clearing the global. Steve Brown Link to comment Share on other sites More sharing options...
CobaltSky Posted November 16, 2002 Share Posted November 16, 2002 To display a message dialog, you will need to attach a script to the search button which starts out with the Show Message command. When specifying the message to use with the show message command in ScriptMaker, you will notice that there are three text boxes at the bottom of the dialog, which have the default text 'OK' and 'Cancel' in them. You will be able to delete the default text and put the names of your three databases there. Then when the message is displayed, there will be three buttons along the bottom, with the database names on them for users to choose between. The next step is to find out which button the user chose and call the appropriate 'find' script (to take them to the correct file and through the find process in that file). This can be done using the 'Status(CurrentMessageChoice)' function in an 'If [ ]' script sequence. So, the whole script will look something like this: 1[color:"white"]... Show Message ["Which Database do you want to search?..."] 2[color:"white"]... If ["Status(CurrentMessageChoice) = 1"] 3[color:"white"]...... Perform Script [sub-scripts, "Search Db 1"] 4[color:"white"]... Else 5[color:"white"]...... If ["Status(CurrentMessageChoice) = 2"] 6[color:"white"]......... Perform Script [sub-scripts, "Search Db 2"] 7[color:"white"]...... Else 8[color:"white"]......... Perform Script [sub-scripts, "Search Db 3"] 9[color:"white"]...... End If 10[color:"white"].. End If The button label text doesn't show in the script parameters above, you will only see it when you double-click on the Show Message step to call up the parameter dialog - and of course, when the script is actually running Link to comment Share on other sites More sharing options...
jasonwood Posted November 17, 2002 Share Posted November 17, 2002 To add to and clarify Ray's message... The actual find scripts are located in each of the 3 database files. Basically in each of the three database files you'd have a script to enter find mode and refresh the screen (bring it to the front)... you could make it more sophisticated if you like. Call it "Search Db 1" in the first table for example. When the user clicks one of the buttons in the dialog, the script activates this "external" script. "External" meaning it's a script from another database file. -- Jason Wood HeyWoody.com Link to comment Share on other sites More sharing options...
CobaltSky Posted November 17, 2002 Share Posted November 17, 2002 Well, not necessarily - which is why I was careful not to prescribe a method for performing the 'find'. One of the sub-scripts will be in the same file as the message script. The other two may be external - but they need not be. For example, one of the most efficient ways to set up a script to automatically locate records meeting particular criteria is to: 1. Set up a global field with text that you are looking for in it (or a calculation which produces the result you are looking for - such as a calculated date range based on the current date). 2. Set up a relationship which links the global (or calc) field to the field (in the same or another file) that you want to search on. 3. Use either a button or a script to 'Go to Related Record [show only related]' based on the relationship defined at 2. There are numerous variations on this approach. Using this technique for searching, all three sub-scripts would be in the same file as the main script. Even if the mechanism for searching does involve a 'Perform Find' step in the destination file, it is quite possible that some values from the current file may be retrieved for use in the search - and therefore it is not safe to assume that an external script is to be called directly from the message script (ie it may as likely be called as an external sub-script of another script within the main file). Since mousaev asked for advice about how to get the message/choice functionality to work, not about how to script the searches, I took care to construct an answer which would be applicable to a range of searching methods, which did not presume a preferred method, and which was concerned with answering the question which was actually asked. Link to comment Share on other sites More sharing options...
Recommended Posts
This topic is 7966 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