1 2 Previous Next 16 Replies Latest reply on Jun 13, 2017 7:20 AM by beverly

    Is It possible to create a module, class, routine, ...

    paulsondervan

      Example

      In my application I have a hamburger menu.

      Everytime I change something in this menu, I have to copy this menu and replace it in all the forms that have that menu.

      ----------------------------------

       

      What I would like to have is a way to define this menu as a module, class, routine, whatever you want to call it.

      If I change something in that menu (module, class, ...), it automatically updates the menu in the forms that have that menu.

      This way I don't have to think which forms must be updated after a change.

      I think this can be useful for many parts in FileMaker.

      Is this possible or is copy/paste the only option?

        • 1. Re: Is It possible to create a module, class, routine, ...
          piaccounting

          Good question thanks. I'm not sure that Filemaker has Class modules and instantiation like you get say in Microsoft Visual FoxPro; the closest is probably "Themes" - so will be interested in what more experienced users have to say too.

          • 2. Re: Is It possible to create a module, class, routine, ...
            Markus Schneider

            FileMaker doesn't support modules/classes directly - but there are workarounds (-:

             

            a simple one for the hamburger:

            - one table with the labels for the buttons (=menu-items)

            - one pop-up menue with a button bar

            - the buttons (=menu-items) of the button bar are calling all the same script, with param=1 for the first button, param=2 for the second, etc

             

            buttons (=menue-items) are getting their labels per calculation (sql), the script calls subscripts for every parameter it will receive. So You can manage it basically in one script and one table for the button-labels

            • 3. Re: Is It possible to create a module, class, routine, ...
              arjen.evertse

              Using a button bar you can also set the menu items in a list (global field, global variable) at start up. Add as many menu buttons to your button bar as you might possibly use somewhere in the future.

               

              You can specify the button label with GetValue ( yourlist ; n ) where n is the button number. You also add a hide condition to the button isEmpty ( GetValue ( yourlist ; n ) ) to make sure you hide the buttons for the items that are not used.

               

              If you happen to add new menu items in the future you add these to you list and the button will appear. You are just limited to the the number of buttons you have initally added to your button bar.

               

              Like Markus said, each button runs the same script using a parameter n, from there you branch for each parameter and can do whatever needs to be done.

              • 4. Re: Is It possible to create a module, class, routine, ...
                BruceRobertson
                Good question thanks. I'm not sure that Filemaker has Class modules and instantiation like you get say in Microsoft Visual FoxPro; the closest is probably "Themes"

                What is the point exactly of making such an obviously unfounded statement?

                A Theme is not a script, it is not a portal, it is not a relationship.

                • 5. Re: Is It possible to create a module, class, routine, ...
                  paulsondervan

                  The hamburger menu was just an example.

                  Solutions on how to create menu's is not the question.

                  So please stop providing solutions on how to create menu's.

                   

                  I'm interested in the possibility to have an class, or whatever, that can be created and used in forms without the need to copy/paste it in forms every time something is changed.

                  • 6. Re: Is It possible to create a module, class, routine, ...
                    arjen.evertse

                    >>What I would like to have is a way to define this menu as a module, class, routine, whatever you want to call it.

                    >Solutions on how to create menu's is not the question.

                     

                    I'm not sure what your question is exactly then. If you are looking specifically for classes or something like that it does not exist in FM in that form, but ways to avoid double work are many including the way to create a menu described before. For other parts it depends but think about:

                     

                    - Custom functions

                    - Subscripts

                    - Selector Connector model to re-use lay-outs, relationships and scripts from different contexts

                    - ....

                    • 7. Re: Is It possible to create a module, class, routine, ...
                      jfletch

                      piaccounting was right: themes are one way that things can by STYLED and changed everywhere all at once. Unfortunately, that is not a concept that can be applied as easily elsewhere in the FileMaker platform. Context, so important to the way FileMaker works, usually throws cold water on such dreams.

                       

                      . There are some ways that you can write scripts and calculations that can be made to be location aware, so that they can be copied and pasted around and have the same functionality. A thorough understanding of FileMaker's native functions can give you some ability there. I have used "GetField" and "GetFieldName" the most.

                      . Elements of Todd Geist's "Selector-Connector" can be used to create layout elements that are less (but not totally) context-independent, as I demonstrated at last year's Pause on Error and others blogged about before that.

                      . IMO, the most-used approaches for creating multi-context elements involve virtual techniques like Mr. Robertson's own Virtual List gem, and a very handy variant known as Magic Value List (evidently rediscovered every few years by different people).

                       

                      Jonathan

                      • 8. Re: Is It possible to create a module, class, routine, ...
                        beverly

                        There is no concept like an "include" that can be defined once and used on multiple layouts.

                         

                        The 'closest' you might get is a Card Window that can be called from any Parent Layout (relationship not required). There are several usage suggestions in this forum, if you search.

                         

                        Sent from miPhone

                        • 9. Re: Is It possible to create a module, class, routine, ...
                          planteg

                          Hi,

                           

                          in FileMaker, there is no way to do object oriented programming (class, method, properties, inheritance, etc.). I understand that object oriented development is a bonus.

                           

                          I'm interested in the possibility to have an class, or whatever, that can be created and used in forms without the need to copy/paste it in forms every time something is changed.

                           

                          Now we are getting closer to what you wish to do. First, there are no forms in FileMaker. there are Layouts. Thing is Layouts are linked to a specific Table Occurrence, and the fields are from that TO. You can't have floating fields that are fed at runtime. If you could explain some more what you would like to achieve, we may suggest solutions to you.

                          • 10. Re: Is It possible to create a module, class, routine, ...
                            jfletch

                            You can make your scripting more modular, like "function scripting" where you provide the context in the input parameters.

                            • 11. Re: Is It possible to create a module, class, routine, ...
                              jfletch

                              You might get away with using the "universal context" aspect of Todd Geist's "selector-connector." By setting the correct global fields in the SELECTOR table you can put the appropriate fields from the appropriate record(s) on a layout from any table. This is as close to context-independent as it gets in FileMaker. (Well, not really, since you are actually relating your table to ALL of the other tables.)

                               

                              Another thing is if you use UUIDs, you can actually have one global in a parent table (the SELECTOR table) show the contents of the correct record of one of any number of tables. It can simplify the relationship graph tremendously, and it can allow you to put any field on any layout, as long as you can set the proper parent key. You can even frequently put fields from multiple tables on the same layout as long as you set the proper key, or multi-key.

                               

                              [One of my favorite advantages of universal context is the ability to write any old ExecuteSQL query without getting warnings that you are using an unrelated table occurrence when you are using the custom functions that take FileMaker-maintained Fully Qualified Field Names.]

                               

                              I use this approach rather frequently, much to the horror of certain of my FileMaker comrades who haven't yet seen the light.

                              • 12. Re: Is It possible to create a module, class, routine, ...
                                piaccounting

                                jfletch wrote:

                                 

                                themes are one way that things can by STYLED and changed everywhere all at once.

                                Thank you. That is what I thought and according to:

                                 

                                 

                                http://help.filemaker.com/app/answers/detail/a_id/11674/related/1

                                When you save styles in a theme, FileMaker Pro applies your changes to every layout that uses that theme automatically.

                                 

                                which is the closest I've found in context of what I believed was behind the original posting. Quad erat demonstrandum.

                                 

                                 

                                • 13. Re: Is It possible to create a module, class, routine, ...
                                  piaccounting

                                  BruceRobertson wrote:

                                   

                                  Good question thanks. I'm not sure that Filemaker has Class modules and instantiation like you get say in Microsoft Visual FoxPro; the closest is probably "Themes"

                                  What is the point exactly of making such an obviously unfounded statement?

                                  A Theme is not a script, it is not a portal, it is not a relationship.

                                  Exactly.

                                  • 14. Re: Is It possible to create a module, class, routine, ...
                                    siplus

                                    I find it quite unpolite to post a question about a specific topic and then saying "this was just an example, stop providing solutions to this".

                                     

                                    Me no like.

                                    1 2 Previous Next