GregLB Posted November 7, 2006 Posted November 7, 2006 Hi can someone please help? I have a table "contacts" which is all contacts. A new contact starts off as a "Prospect" selected in a drop down field (Prospects or Projects). When the prosprct becomes a confirmed "Project" the drop down selction is changed to "Project. I would like to asign a script to a button to enable me to list e.g all "Prospects" in a list layout with the sort criteria being the value of the Prospect/Project drop down box. Thanks Greg
mr_vodka Posted November 7, 2006 Posted November 7, 2006 Greg, All you really have to do is create a script that Performs a find with the specified request (Prospects or Projects = 'Prospects', perform the sort, and then goes to the list layout that you want. However, I am wondering why you would perform a sort on records that will only be showing records that are already set with the value 'Prospects'.
gephry Posted November 7, 2006 Posted November 7, 2006 There are two things that come to mind from what you are asking and I'm not sure which you are going for. First it sounds like you want to view only Prospects, but then you state that you want the sort criteria to be Prospect or Project. So: 1) Do you want the button to FIND all "Prospects" and then sort by last name or company/etc---only Prospects will be shown. 2) Do you want the button to TOGGLE how the list is sorted---i.e. "Prospects" at the top, press the button again and then "Projects" would be at the top.
GregLB Posted November 9, 2006 Author Posted November 9, 2006 Hi Gephry Sorry I tried to reply to your post the other night but the reply to post link wasnt working? Yes option 1. I want the button to FIND all "Prospects" and then sort by last name or company/etc---only Prospects will be shown in list view. The reason for this is that I have many more prospects than confimed customers and dont want to browse through unconfirmed projects/customers. Many thanks Greg
gephry Posted November 10, 2006 Posted November 10, 2006 No problem Greg. Okay, option #1. There are two ways to accomplish this "show only...PROSPECTS/PROJECTS" The (much) better of the two is naturally a little more complicated---that involves Portals. But that could be a bit over your head right now. So let's just discuss the buttons that you asked about---this is also the easier way. We'll go from square one just to be safe because I'm not sure if you've made scripts before, etc. Probably the easiest way for us to do this is to create two scripts & two buttons -- one for Prospect and one for Projects. Actually, we can also create a third script and third button which will show and sort ALL contacts, no matter if they are Prospects or Projects. First, let's make the scripts: 1. Go to the "Scripts" menu and choose the first option (should be named "Scriptmaker"). 2. Click "New Script." Give it a name. Along the right, there will be a big white area---that's where your code shows up. In order to insert code, you have to select it to the left. It's not like a big editor where you can just write pure code in the white area. You select it from the left and then specify the parameters on the right. 3. Two ways to do this. The first allows you to specify variables and manipulate the find mode in different ways. The second way is more specific and is a bit faster. We'll want to use the second ( but I'll explain the first, just so you know the two ways it can be done: A. PROSPECT Along the left, scroll down to where you see Enter Find Mode. Double-click "ENTER FIND MODE." Then scroll up to to "Set Field" and double-click. Along the right, select "SET FIELD[]." Near the bottom you will see two buttons, one that says "Specify Field" and one that says "Specify." Click "Specify Field" --- choose the name of the field that contains the values "Prospect" or "Project." Click OK. Next, click "Specify" and type in "Prospect" --- make sure you include the quotation marks (that tells Filemaker you are searching for text, if you don't have quotes, it will think you are specifiying a variable or a field). Click OK. Next, along the left, scroll to "Perform Find" and double click it. If you want to sort the records after you perform the find, scroll to "Sort" and then do a similar "Specify" along the right that we did with the "Specify Field." You can choose how you want it to sort by adding fields into the sort dialog---for example: you add Last Name, First Name, Company and Filemaker will sort alphabetically (or numberically) by the values Last name, then by first name, then by company. Make sure you click the checkbox "Perform Without Dialog" --- if you leave this unchecked, a window will popup asking you to confirm how you want to sort. If you check the box, it'll just sort without asking you. So now we are done with this script. This script will find and sort all Prospects. Click the OKAY button at the bottom right of the screen. You will be taken back to the list of scripts and you should see this script in the list. Projects To make the next script easier, click the script you just made and click "Duplicate." Then select the duplicated script and EDIT it. Give it a new name, and change the SET FIELD[] from "Prospect" to "Project" --- this script will now find and sort all "Project" records. Click OKAY. Show All Let's create a new script, a "Show All" script. Click New Script and give it a name. Scroll along the left to "Show All" and double click---it should show up along the right. Then, scroll to "Sort" and double click. Let's specify a new sort. Since this will show all records, you can specify however you want. Alphabetical order by: Last Name, First Name, Company, PROJECT/PROSPECT.... Or you can specify so that it will lump all Projects together, and then by name like this: PROJECT/PROSPECT, Last Name, First Name, Company. That will lump all Projects together, then sort alphabetically by last name/first name/company, and then it will sort alphabetically by last name/first name/company withint Prospects. Make sense? Click Ok. B. Read A before you do this step. It's important that you understand that there CAN be multiple steps to this Find process; the multiple steps would allow you to use variables and global field values. With this option, we just use a simple "Perform Find." Scroll to "PERFORM FIND" along the left. Double-click that selection and you will see it show up along the right. Select that, and click "Specify." You will see an empty window with two columns (if you don't, delete the one you see). Click "New" -- now select the field name along the left that contains either "Project" or "Prospect." Then, under "Criteria", type in "Prospect" and click "Add." Click Ok, and then Ok again. This script will now PERFORM a FIND on all records matching "Prospect." Add the sort step like 3A above, and then create the two more scripts (Project, and Show All) as we did above, but do Project the way you did Prospect. Click OK, and you've made your scripts! Let's exit out of the Scriptmaker by clicking OK. 4. Layout On the layout where you view your list of people, create some text or a button that will act as your button. If you already have text/button, right click on it and select "Specify Button." Along the left, you will see a list. (The list is pretty much exactly that same as to the list you saw when making the scripts---you can have a button perform ONE of these actions without having to make a script. To perform multiple actions, i.e. Find and Sort, we have to make a script.) Select "Perform Script" and then choose "Specify" along the right. Select the corresponding script from the list that pops up (the scripts that find: Prospects, Projects, or Show All). Click Ok, and click Ok. Now that button will perform that script every time you click it. Create two other buttons to perform the other two scripts. Assign the scripts to those buttons the same way we just did that one. So! Long story short, you have three buttons, each that show and sort pre-specified data in a pre-specified order. I hope this didn't confuse you. There are tons of ways to accomplish the same thing in Filemaker which is what makes it so powerful. This is the easiest way to do what you want. Not the greatest in my opinion, but it does what you want at a level that isn't too far above your head. Remember, the only way to learn is to experiment. ALWAYS ALWAY ALWAYS back up your data (copy the file somewhere!) before you start screwing with stuff. You DON'T want to learn that the hard way.
Recommended Posts
This topic is 6590 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