1 2 Previous Next 15 Replies Latest reply on Jan 23, 2014 5:47 AM by AlanStirling

    Filemaker Functions: button within an object

    roryduffy

      Hi guys,

       

      I want to place a button inside a portal object, and then script the button to get the table and / or field name of the related record within that active portal object.

       

      Is there a method / function that will enable me to do this?

       

      Cheers,

       

      Rory

        • 1. Re: Filemaker Functions: button within an object
          Oliver_Reid

          Using the field name from the related table on which the portal is based as parameter to the script will pass the VALUE in that field on the row where you click the button to the script attached to that button.

           

          I think that is what you mean. If you want literal NAME of a field that is more complex.

          • 2. Re: Filemaker Functions: button within an object
            roryduffy

            Hmmm... I almost understand, but not exactly clear how to do this.

             

            Basically, I want to create a button, call it "GO" and put it within a portal showing dates_events.

             

            I want the button to take me to the related event record.

             

            So I need to create a script called "GO" and assign it to the button.

             

            The script needs to say:

             

            1) if the table of the active portal (portal in which the button resides) = dates_events

            2) then go to the related record: events

            3) using layout

            <( ( Left ( ( Get ( LayoutName ) ) ; 5 ) ) & ( "text" ) )> for e.g.

             

            So, I would need correspondingly:

             

            1) some kind of function that returns the table name of the portal in which the button resides

            2) some kind of function that returns the table name of the related record within that portal, or even stipulate a table name for the related record that I want it to go to

             

            Possible?

             

            Step 3) layout definer part should be simple. It's just steps 1-2, 1) identifying the data within the active portal, and 2) deciding, on the basis of that, the table of the related record within that active portal.

             

            Thanks a lot!

             

            Rory

            • 3. Re: Filemaker Functions: button within an object
              ryantittle

              Rory,

               

              When you create a portal or any field, you specify which table it is referencing. I don't really get how you could need to determine which table, it should be known, and not change. Or, am I missing something here?

              • 4. Re: Filemaker Functions: button within an object
                mark_b

                Hi Rory,

                 

                I may be wrong, but it looks like you are trying to do too much of the work.  Is this something like what you want?  You have a portal with stuff in it (like dates).  You want a button in the portal row that when you click on that button, it brings up the full record.  Below I have a portal with a bunch of names in it.  When I click on the button, it shows the detail record for that person. If this is something like what you want it is easy.  Let me know.  Cheers, Mark

                2014-01-21_10-58-23.png

                • 5. Re: Filemaker Functions: button within an object
                  roryduffy

                  Well, I want to be able to place this "GO" button within any portal, and for it to find the related table data without me having to re-programme the button from portal to portal.

                   

                  I tend to work across a fixed set of defined relationships, but across a potentially infinite versions of layouts - showing different amounts of data - depending on who is using the layout.

                   

                  If I change one of these layouts, I want to be able to copy and paste the portal with its go button into the layout, and not have to re-programme it every time.

                   

                  In other words, I'm trying to come up with something a bit more sophisticated, a unified script, that I can use across different layouts with varying portal setups.

                   

                  e.g.,

                   

                  If

                  Table of active portal = dates_events

                  Then get related record from events using layout X

                  Else If

                  Table of active portal = dates_artists

                  Then get related record from artists using layout Y

                   

                  etc...

                   

                  Cheers,

                   

                  Rory

                  • 6. Re: Filemaker Functions: button within an object
                    roryduffy

                    Exactly Mark, I'm trying to go to related record.

                     

                    But I want the script to detect the table and take me to the corresponding record in the corresponding layout based on that table

                     

                    i.e., a case or multiple if script

                     

                    So that I can simply copy and paste the button across different portals.

                     

                    Thanks,

                    Rory

                    • 7. Re: Filemaker Functions: button within an object
                      mark_b

                      If I change one of these layouts, I want to be able to copy and paste the portal with its go button into the layout, and not have to re-programme it every time.

                       

                      When you define a portal for a layout, you automatically set up the relationship between that portal and that layout.  If you copy a portal to a different layout, you must redefine the relationship between the different layout and the portal from the previous layout.  Othewise there is no way that the records in the portal know how to get to the related record in the layout.  I don't know of a way to automatically build new relationships through scripts.  Maybe someone else has a method.  Here's the table occurances for the demo above.

                      2014-01-21_11-13-23.png

                      • 8. Re: Filemaker Functions: button within an object
                        roryduffy

                        Ah, I see.

                         

                        OK, let's say I wanted to replicate a dates_events portal across multiple versions of the same layout (Dates).

                         

                        How could I get the "GO" button to run a case script, pick up on the fact that the portal within which the button resides is pointing to dates_events, and then go to the related record of that portal (events)?

                         

                        e.g., I have 7 layouts, all showing Dates:

                         

                        Department1Dates

                        Department2Dates

                        Department3Dates

                        Department4Dates

                        Department5Dates

                        Department6Dates

                        Department7Dates

                         

                        I'm in Department1. I want the button to run as follows:

                         

                        If

                        Table of active portal = dates_events

                        Then get related record from events using layout Department1Events

                        Else If

                        Table of active portal = dates_artists

                        Then get related record from artists using layout Department1Artists

                         

                        So, I'm not necessarily using the same portal across all layouts, but I want to use the same "GO" script for the "GO" button across all portals so that it detects the related table, takes you to the related record and calculates the layout based on the Department that I'm in.

                         

                        Does that make sense?

                         

                        Thanks again,

                         

                        Rory

                        • 9. Re: Filemaker Functions: button within an object
                          mark_b

                          The "Go" button will be located inside the portal row.  So when the user clicks on that button, the system automatically knows what portal is active and since that portal has a relationship defined to the layout it's on, all the "Go" button needs is a "GoToRelated Record" and nothing else, since the relationship was defined when you created the portal.  Make sure that your records have unique keys defined so you can go to the correct record.

                           

                          I'm also wondering why you need so many layouts.  There could be a "login" layout/script where the user enteres their department and then only their records would display on one layout.  That could be managed either by a security setting for that layout or one of many other ways to show only selected records on a given layout.

                          • 10. Re: Filemaker Functions: button within an object
                            Oliver_Reid

                            Always avoid "variations on  alayout" --  it's  maintenance nightmare

                             

                            I would use one layout and use a portal filter to show only the dates you want to see

                             

                            Instaed of switching layouts, use a global field to set a value used in the filter calculation. (e.g. show rows only when:  related_feild=global)

                             

                            You can specifie the filter values in a value list and use a radio button format to select the value for the gobal field.

                             

                            If you send me the file I will set that up for you.

                            • 11. Re: Filemaker Functions: button within an object
                              Malcolm

                              I want to place a button inside a portal object, and then script the button to get the table and / or field name of the related record within that portal.

                               

                               

                              Is there a method / function that will enable me to do this?

                               

                              It isn’t as simple as saying “what portal am I in? which table is it pointing to?” but its still quite easy.

                               

                              You can name an object and using GetLayoutObjectAttribute you get the source.

                               

                              Another option is to use GetFieldName; specify a known field. You’ll then be able to get the field name and the table name

                               

                              Malcolm

                              • 12. Re: Filemaker Functions: button within an object
                                roryduffy

                                Thanks guys, all very useful suggestions. Lots for me to explore, experiment and try.

                                 

                                I'll come back soon and let you know what I decide to do or if I have any other queries.

                                 

                                Cheers,

                                 

                                Rory

                                • 13. Re: Filemaker Functions: button within an object
                                  roryduffy

                                  Just reading over the replies last night. Oliver mentioned something quite close to what I'm looking for.

                                  Using the field name from the related table on which the portal is based as parameter to the script will pass the VALUE in that field on the row where you click the button to the script attached to that button.

                                   

                                  I think that is what you mean. If you want literal NAME of a field that is more complex.

                                   

                                  Here's the script that I'm building:

                                   

                                  If

                                  [( ( Get ( FieldName ( [table occurrence:field of related table] ) ) ) = ( dates_events::ID ) )]

                                  Go to Related Record [From table: "events"]

                                   

                                  Else If

                                  [( ( Get ( FieldName ( [table occurrence:field of related table] ) ) ) = ( dates_artists::ID ) )]

                                  Go to Related Record [From table: "artists"]

                                   

                                  etc. for all table occurrences

                                   

                                  End If

                                   

                                  where [table occurrence:field of related table] = the table/field of the related record.

                                   

                                  Effectively, I want to do exactly as Oliver suggested, - using the field name from the related table on which the portal is based as a parameter to the script. How exactly do I do this?

                                   

                                  When you define a portal for a layout, you automatically set up the relationship between that portal and that layout.  If you copy a portal to a different layout, you must redefine the relationship between the different layout and the portal from the previous layout.  Othewise there is no way that the records in the portal know how to get to the related record in the layout.  I don't know of a way to automatically build new relationships through scripts.  Maybe someone else has a method.  Here's the table occurances for the demo above.

                                   

                                  I'm not looking to automatically set up a portal or build new relationships through scripts. The portal would already be set up. It's the go button that I want defined by the portal it is in.

                                   

                                  Basically, I'm looking for a way to 1) Get the table/field reference for the related record, and 2) use that as a parameter in my script. Does such a function exist?

                                   

                                  Cheers,

                                   

                                  Rory

                                  • 14. Re: Filemaker Functions: button within an object
                                    roryduffy

                                    Just reading over the replies last night. Oliver mentioned something quite close to what I'm looking for.

                                    Using the field name from the related table on which the portal is based as parameter to the script will pass the VALUE in that field on the row where you click the button to the script attached to that button.

                                     

                                    I think that is what you mean. If you want literal NAME of a field that is more complex.

                                     

                                    Here's the script that I'm building:

                                     

                                    If

                                    [( ( Get ( FieldName ( [table occurrence:field of related table] ) ) ) = ( dates_events::ID ) )]

                                    Go to Related Record [From table: "events"]

                                     

                                    Else If

                                    [( ( Get ( FieldName ( [table occurrence:field of related table] ) ) ) = ( dates_artists::ID ) )]

                                    Go to Related Record [From table: "artists"]

                                     

                                    etc. for all table occurrences

                                     

                                    End If

                                     

                                    where [table occurrence:field of related table] = the table/field of the related record.

                                     

                                    Effectively, I want to do exactly as Oliver suggested, - using the field name from the related table on which the portal is based as a parameter to the script. How exactly do I do this?

                                     

                                     

                                    When you define a portal for a layout, you automatically set up the relationship between that portal and that layout.  If you copy a portal to a different layout, you must redefine the relationship between the different layout and the portal from the previous layout.  Othewise there is no way that the records in the portal know how to get to the related record in the layout.  I don't know of a way to automatically build new relationships through scripts.  Maybe someone else has a method.  Here's the table occurances for the demo above.

                                     

                                     

                                    I'm not looking to automatically set up a portal or build new relationships through scripts. The portal would already be set up. It's the go button that I want defined by the portal it is in.

                                     

                                    Basically, I'm looking for a way to 1) Get the table/field reference for the related record, and 2) use that as a parameter in my script. Does such a function exist?

                                     

                                    Cheers,

                                     

                                    Rory

                                    1 2 Previous Next