12 Replies Latest reply on May 28, 2010 10:30 PM by xTYATESx

    Assign

    xTYATESx

      Title

      Assign

      Post

      Hi, I have been messing around with filemaker for a few weeks now and was trying to figure out a way to have a button on a new list layout view that says assign. When this button is clicked it will assign that record to the current master records fields. 

       

      For example

       

      My main table be Reptiles and my other table being Classification

       

      When a user views a reptile record it will have a button the will say assign classification. When that is clicked a new window opens with a list of classification's and next to each classification will be a button that says assign. When the button is clicked it will fill in that current reptiles record fields ie (common name, family, species. subspecies)

       

       

      but each classification will be able to have multiple reptiles linked to them

        • 1. Re: Assign
          mrvodka

          You need a 3rd table that joins the two tables together. It will store the IDs for the reptile and the Classification records.

           

           

          • 2. Re: Assign
            xTYATESx

            so like a line items table. 

             

            but what kind of button setup to use or script to use

            • 3. Re: Assign
              xTYATESx

              ok is there anyone else who can input on this

              • 4. Re: Assign
                philmodjunk

                You may not need a script at all. Here's a demo file: http://www.4shared.com/file/PLhjErzu/Contracts_to_Companies.html

                 

                In it, you assign "companies" to "contracts" but the prinicple is the same. Note that no scripts are required, you simply select from the pop-up menu.

                • 5. Re: Assign
                  xTYATESx

                  thanks for the file but not quite what i am looking for.

                  • 6. Re: Assign
                    philmodjunk

                    Please explain why. The demo file would appear to do what you asked for in your original post and avoids the need for buttons and scripting--making for a simpler design.

                    • 7. Re: Assign
                      xTYATESx

                      what i am looking for is to have a new window open up so the user can select a classification. Not have a drop down list or pop up menu. 

                      • 8. Re: Assign
                        philmodjunk

                        I'm familiar with the basic taxonomic clasification levels: Kingdom, Phyla, Class, Order, Genus, Species.

                         

                        I assume you want to specify each for a given animal record.

                         

                        When you click that button to open the window, what do you want to see in the window? Surely not all possible kingdom, phyla, class, order, genera and species?

                         

                        How do you picture this working? (Details are important here.)

                        • 9. Re: Assign
                          xTYATESx

                          i would like to show family, species, subspecies, common name.

                           

                          i will have 3 fields on the animals record that say the above. and a button that will open the new window where a user is displayed a list of all the classifications. next to each record will be a button that says assign and when they press that it will close and auto enter there choice on the animals record

                          • 10. Re: Assign
                            philmodjunk

                            OK, Keeping to just the lower classification groups simplifies this. Though to this non-expert, it seems odd that you will specify a family without also having to select a Genus. Just for the record, what you describe can be done with conditional value lists and drop down lists or pop-up menus on each of the three fields. That can be done with little or no scripting so it's simpler to set up.

                             

                            However, you have specifically asked for a pop-up window. That can also be done.

                            First to organize the data. You'll need either three tables or one table with an extra field, the results are pretty much the same for the user so it may depend on the rest of your database design needs or simply your preference as a developer as to which way to go.

                             

                            With a single "Taxonomy" table, define three fields:

                            Level, TaxName, MemberOf all are text fields.

                            Create a list view layout based on this table.

                            All you need on this layout is the TaxName field and your button (or you can make the TaxName field your button if you want.)

                             

                            You'll use the new window command in a script to pop up this layout in a small window with the appropriate records brought up as its found set.  Your button's script on this layout will capture the taxonomy name in a variable and assign it to the appropriate field in the underlying window and then close the pop-uup window.

                            The script (some details will need to be worked out by you):

                            Set Variable [$Level ; Value: getValue ( Get ( ScriptParameter ) ; 1 ) ]

                            Set Variable [$$Field ; Value: getValue ( Get ( ScriptParameter ) ; 2 ) ]

                            Set Variable [$Member ; Value: getValue ( Get ( ScriptParameter ) ; 3 ) ]

                            New Window [//specify name and appropriate dimensions of your new pop up window here]

                            #Following step is needed for Windows systems where the Window is maximized--Not needed for macs or when the window is not maximized.

                            #It assumes that your underlying window has the default window name--which will be the same as the database file name.

                            Move/Resize Window [Name: Get ( Filename ) ; Current File; Height: Get ( ScreenHeight) ; Width: Get ( ScreenWidth ) ; Top: 0 ; Left ; 0]

                            Go To Layout ["TaxonomyList" (Taxonomy) ] //Specify layout you've created for this purpose

                            Enter Find Mode []

                            Set Field [Taxonomy::Level ; $Level ]

                            Set FIeld [Taxonomy::MemberOf ; $Member ]

                            Perform Find[]

                            Sort [No dialog ; Restore] //Sort by Taxonomy name in ascending order

                            #Make pop up "Psuedo Modal" so that user can't click on underlying large window until they've interacted with pop-up window

                            Show/Hide Status Area [Lock ; Hide ]

                            Allow User Abort [off]

                            Loop

                               Pause/Resume Script [Indefinitely]

                            End Loop

                             

                            This script is called by clicking a button next to one of the three fields in the parent window's layout. The same script but pass a different pair of parameters in a list so that the list of potential values can be restricted to just those that are relevant to the taxonomic selections already made.

                            The button next to Family would pass this expression as the parameter: List ( "Family" ; GetFieldName ( ParentTable::Family ) )

                            Species would be: List ( "Species" ; GetFieldName ( ParentTable::Species ) ; ParentTable::Family )

                            Subspecies: List ("SubSpecies; GetFieldName ( ParentTable::SubSpecies ) ; ParentTable::Species )

                             

                            The button on your popup will trigger the following script.

                             

                            SetFieldbyName [$$Field ; Taxonomy::TaxName ]

                            Close Window [Current Window]

                            Halt Script //Terminates the endlessly looping script that opened this window--you can also specify the Halt option on the button instead of this step

                             

                            Note: this approach does not use a Join table as originally suggested at the beginning of this thread. (If you chose to use three different tables, you'd need three different layouts--one for each field in the parent record.)

                             

                            • 11. Re: Assign
                              xTYATESx

                              thanks Phil Ill give it a shot when i get back home

                              • 12. Re: Assign
                                xTYATESx

                                Alrite phil since my flight has been delayed and a new meeting has come up i will have to try this later and let you know how it goes.