7 Replies Latest reply on Feb 1, 2016 11:39 PM by onefish

    constrained find and buttons

    AlexMauer

      Hello,

       

      I have a space data base that has 10k records in it. I want to be able to create a constrained find that returns the room type code so I can see all rooms of a specific type (classrooms, offices, etc)

       

      that is easy enough to do. But to make it easier on my users, I have created a set of buttons for the most commonly searched room types (mechanical, classroom, conference rooms etc.) so I have 10 buttons set up to do the constrain based on the room type code. The problem is that once I click one of the buttons, My record set is now constrained down to just that type of room. Any other button click will result in an error.

       

      How can I set it so that the next room type button I click returns the room records back to the original full state.

       

      entire record set is active, or unsorted. I click the classroom button and it returns 450 results. if I click on offices, I get an error. because there are no offices in the classroom set. I want to put something in the scripting of the button to set it back to the original find and then start the office constrain. If the user starts off by doing a find for all rooms in a particular building and then clicks the classroom button, the constrain wills show all classrooms in that building. again if I click the office button, It will show an error. I want the button to go to the previous search...in this case, the building set and start the office search - the results bing all offices in the selected building set.

       

      Can anyone assist me in doing this?

       

      Thanks,

       

      ALex

        • 1. Re: constrained find and buttons
          onefish

          Alex, I imagine you are in list view? Just use "Show All Records" and "Unsort Records" as the first steps of your script. If you don't want to actually see it flash up on the screen you can also use "Freeze Window" as step 1 and then "Refresh Window" as the last script step. Then the list will seemingly change from one constrained set to another without the user seeing anything in between.

           

          I prefer to achieve what you are trying to achieve with relationships though and not finds in scripts. Then you can simply have one field formatted with a dropdown list, radio buttons, check boxes or whatever with a value list from the room type field, instead of multiple buttons/scripts (ConstField). You just have to be careful as only records matching values in ConstField and the room field will be displayed once the relationship is set. I.E. if no value is selected then no records are displayed.

           

          You can manage this a couple different ways, format ConstField as check boxes and have a script run whenever anyone goes to the layout which selects all on them. The second way involves calculation fields on both sides of the relationship and is a bit trickier (but preferred in my opinion). 

          • 2. Re: constrained find and buttons
            AlexMauer

            I am not in list view. I am in form view. I want the user to use the form I've set up as a user interface.

             

            screen.jpg

            If I do a search on the building number at the top, the gray buttons at the top can be used to search through the set of rooms in a building and then constrain it down. I don't want to back to all records, I want to go back to the building set betweens clicks. So if get into the building, then I want see all utility rooms. when I next want to see all the offices in the building, I don't want to go back to the full set of all rooms, I want to go back to the full set of building rooms and start the next find.

             

            If I am in the whole set and I click utility, I want it to go back to the full set before I click offices.

             

            What ever the state of the pervious find is, I want the  buttons to return to that state, Is the re a way to access the recent searches? and use the last search a the criteria of the next search and then constrain?

            • 3. Re: constrained find and buttons
              onefish

              I'm not quite sure I'm following you 100% but if you really want to use scripts for this and you want to save the last search to revert to then use a global field and have each script set and read it accordingly. It doesn't have to be on the layout.

              • 4. Re: constrained find and buttons
                AlexMauer

                if I open the database, There are 10k room records. the room records have a room type assigned them. If I am in the whole 10k record set and I click the utility space button, the action of the click is to constrain the entire record set down to show only those rooms with the utility code on it. If I then go on and say ok, show me all the classrooms....this is where I am getting the error. The button is not searching the whole record set, it is only now searching through the utility rooms. So I need to get it back to the whole record set and then search through to find all the classrooms. When I am done, I may want to see all the offices. same deal, I am only in the I am constrained down only the classroom records. so again, I need to start back at the whole record set.

                 

                If I start my research off by first doing a building search. Header bar. I am only interested in looking at one building. in this case, 1601. there are 200 rooms in building 1601. I want to see how many rooms are utility. so I click the button and it shows 8 rooms labeled as utility Now I want to see how many classrooms are in this one building, but I get the error because I constrained down to just 8 records (utility) I want to have the click of the classroom button restore the found set to the previous search criteria....200 room records of building 1601 and then perform the constrained find for all classrooms. THis should return 4 records.

                 

                Does that make more sense.

                 

                Thnaks,

                • 5. Re: constrained find and buttons
                  onefish

                  OK, I think I understand now. Is the only scenario where you want to stay within a found record set while conducting subset searches, at the building field? Also, is searching for a building scripted too or is it done through Filemaker native functions? If it's scripted then you can set a global field with the building search criteria as a first step. Then use "Extend Found Set" to the global value as the first step of your subsearch scripts and then "Constrain Found Set" to the room.

                   

                  That should work but it's kind of messy. I strongly recommend that you use relationships to achieve what you're after. It's much cleaner and more intuitive for the user. As an example, I also have a database to manage building assets focused on inspections and maintenance. I use sliding controls from the left of the screen with cascading relationships. Select the inspection and all related communities/towns slide out, select the community and all the related buildings slide out, select the building and.... well you get the idea. The user can revert anywhere up or down the hierarchy at any time easily.

                   

                  Still, as you have already got something to work with and may not be able to overhaul the navigation you may want to have a look at the TOG method to save a found set here http://www.sumware.net/robfm/savingfoundsets.php . It should work even if the building level search is not scripted (but it uses relationships :-).

                  • 7. Re: constrained find and buttons
                    onefish

                    Alex, here's a rough example of one way that you might be able to use relationships for your file. It uses a portal to display related records which might not work for you if you already have a portal on your layout (hard to tell from the pic). You can use GoToRelatedRecords instead of a portal to achieve a similar result.