1 2 Previous Next 22 Replies Latest reply on Jun 28, 2017 8:39 AM by gofmp15

    Why use a repeating field?

    ChrisJohnston

      I have tried to read about repeating fields, and I just don’t get it. Could somebody explain why you would want to use a repeating field? Does anybody have any simple, concise examples of a solution that uses a repeating field to its advantage? Thanks

        • 1. Re: Why use a repeating field?
          coherentkris

          Take a look at fmeasyCalendar, soSimplecanlendar and possibly dayback from Seedcode.

          I'm pretty sure they all leverage repeating fields.

          They do have there uses but since FM became a relational database in .fmp7 there usefullness is dwindling.

          • 2. Re: Why use a repeating field?
            onefish

            I used to use repeating fields a lot before conditional formatting became available to show different buttons, etc based on field contents, and other UI tricks. I have never used them for storing important data though.

             

            As an example, you can have a global container field with Nth number of repetitions and store a different button graphic in each one. Then use a calculation field to get repetition based on whatever criteria you want from your record. Format the calculation field as a button and attach a script which uses the same record criteria to perform different functions.

             

            -----EDIT-----

            I've never actually done this but it would be rather easy to create several user selectable themes using this technique, including graphics for the background, etc.

            • 3. Re: Why use a repeating field?

              I've never used repeating fields.  In most applications, you just wouldn't consider them.

               

              You can think of a repeating field as a way, in a one-table solution, to mimic 1:M data in a cludgy non-relational kind of way.

               

              FileMaker's own help files says this: "In a solution where there is only one table or no need to relate records that exist between multiple tables, a repeating field can be used to display multiple values using only one field."

               

              And..

               

              The only "advantage" of a repeating field listed: "Does not require any understanding of multiple table relationships"

               

              Portals & Repeating Fields | FileMaker

               

              ----

               

              I've been using FMP for about six years and have never used, or considered, a repeating field.

               

               

               

              - m

              1 of 1 people found this helpful
              • 4. Re: Why use a repeating field?
                Markus Schneider

                take it as a simple array, but don't use it to store data

                 

                before FileMaker became relational (starting with V3), it was a perfect method for all kind of stuff...

                • 5. Re: Why use a repeating field?

                  Speaking of arrays, why FM doesn't have an array data structure?

                   

                  - m

                  • 6. Re: Why use a repeating field?
                    coherentkris

                    Variables can have repetitions which can be used like an array.

                    The return delimited list also can function like an array.

                    • 7. Re: Why use a repeating field?
                      siplus

                      As long as you don't use repeating fields for storing data, they are an invaluable instrument in programming.

                       

                      Example: Our agenda fetches data via ExecuteSQL and displays it in a global repeating field.

                       

                      Example: my own display_results_as_you_type, optimized for speed in a multiuser environment, uses arrays.

                      It could have been done without, but readability and compactness of the code would suffer.

                       

                      at its core you can find:

                       

                      Set Variable [$Len; Value:Length(PatientSmall::gSQLSearch)]

                      If [$len > 15]

                      Exit Script [Result: False]

                      End If

                      If [$Len > 0]

                      Set Variable [$query; Value:"SELECT FK_PatientNumber FROM PatientSmall WHERE ClientNameArray[" & $Len &"] = ?"]

                        Set Field [Patient::gSQLFoundSet; ExecuteSQL($query ;"";"";  Upper(PatientSmall::gSQLSearch))]

                      Perform Script [“CommitAndGo”]

                      Set Variable [$$Found; Value:ValueCount(Patient::gSQLFoundSet)]

                      Else

                        Set Field [Patient::gSQLFoundSet; ""]

                      End If

                       

                      where ClientNameArray is defined as repetition calc with 15 reps,

                       

                      Let(

                      rep = Get ( CalculationRepetitionNumber );

                      Left(Extend(FullNameUPPER); rep)

                      )


                      and FullNameUPPER is defined as Upper(Surname & " "  & First name)

                      • 8. Re: Why use a repeating field?

                        Good points.

                         

                        I was thinking about programmatic arrays with indexes and such, however. That was the point I was pondering. I wasn't thinking of workarounds, just wondering why such a basic memory structure isn't there.

                         

                        It would be nice if you could do SQL -> Array, then pass that array to a script, CF, or whatever. Define an array that could be a value list. The "list", so to speak, goes on and on.

                         

                        So, rather than think of things in FM that can "act like arrays", I was thinking more of why there aren't arrays themselves that are arrays on their own and not interpretations of arrays from other FileMaker structures.

                         

                        Thanks for your reply.

                         

                        - m

                        • 9. Re: Why use a repeating field?
                          beverly

                          +1

                           

                          We do have "LISTS" (quasi-array) and associated functions. List() and anything with "Value" in the name:

                          Text functions

                           

                          here are links to the Ideas (suggested in this forum) that are 'array-aware":

                          Multidimensional Arrays

                          Built-in JSON Functions

                          Perform JavaScript Function

                           

                          and this forum post with helpful links:

                          How to create a multidimensional array?

                           

                          there are custom functions & plug-ins with array functions:

                          Custom Functions » Arrays - Proposals - FileMaker Coding Standards

                          FileMaker Custom Function:ArrayValue ( array ; index )

                          Monkeybread Software - MBS FileMaker Plugin - Release notes

                          http://www.modularfilemaker.org/module/json/

                           

                          but, yes, I'd love more "arrays" functions built-in.

                          beverly

                          1 of 1 people found this helpful
                          • 10. Re: Why use a repeating field?

                            You're the best!

                             

                            Thanks, Bev.

                             

                            -- m 

                             

                            P.S. I know you know this already, but I wasn't trying to make a Federal case out of my array question.

                             

                            (Just making sure others know this as well...)

                            • 11. Re: Why use a repeating field?
                              beverly

                              I do use repeating fields on occasion, though not as much as in the past. There is a trick to finding (with OR) in portals that needs repeating field. However, there are now other ways to perform finds (including ExecuteSQL function), that this work-around is no longer needed.

                               

                              The Extend function

                                   Extend

                              is pretty slick, but through CF and other means, we can simulate.

                               

                              If this field-type works for you, use it, but consider the use of related data, variables and the other methods described in this thread. Consider all the caveats (using with external connections - xDBC, XML, web, export, import, etc.) that might occur and you will find compelling reasons to NOT use them.

                               

                              beverly

                              • 12. Re: Why use a repeating field?
                                siplus

                                morkus wrote:


                                It would be nice if you could do SQL -> Array

                                 

                                see attached example....

                                 

                                Another important point, illustrated in the attachment: a list field has to be text (try to change the definition to number in my example and see what happens). As such, you can't sum() it.  But the array can be easily summed...

                                • 13. Re: Why use a repeating field?
                                  Fahri Akar

                                  Repitations are valuable in many case.

                                   

                                  1- Easily make complex calculations using set of repitation fields on a temporary layout.

                                  2- You can display repitations in horizontally or vertically.

                                  3- You may use repeting fields inside a portal but you can not use a portal in another portal.

                                   

                                  Fahri

                                  • 14. Re: Why use a repeating field?
                                    Steve Wright

                                    coherentkris wrote:

                                     

                                    Take a look at fmeasyCalendar, soSimplecanlendar and possibly dayback from Seedcode.

                                    I'm pretty sure they all leverage repeating fields.

                                    They do have there uses but since FM became a relational database in .fmp7 there usefullness is dwindling.

                                     

                                    This is one of the reasons I use them. They have the ability to expand proportionally, instead of just having one field expand and the others fixed.  I don't use them to store real data, just for temporary display purpose.

                                    I wish we could do this with other objects / object groups or even % widths but that's another topic

                                    1 2 Previous Next