10 Replies Latest reply on Jul 30, 2014 5:17 AM by Oliver_Reid

    In praise of repeating fields and repeating global variables

    NickLightbody

      Reading some old stuff recently warning folk about the dangers of using repeating fields - after FileMaker had become relational - it occurred to me how many design problems I could not have solved without them and though perhaps we should have a thread exploring what folk are using these repeating field and variables at present?

       

      (1) I have used repeating fields as a method of storing different language strings for a couple of years now as - for me - a preferred method of easily swopping languages. The user picks the language "n" they wish to use and the nth repeat from each field in the language table is published by setting the relevent global variables. So the Ui is populated with global variables which display whichever is the currently selected langauge.

      Pros: fast, very easy to maintain, rock solid and no relationships required for langauge

      Cons: none known

       

      (2) Having recently designed an new very fast App for mobile I had a need to add and remove - at will - a series of text labels from within data fields displayed to the user. Extracting strings and storing them for later reuse in a repeating field in the relevant data record turned out to be the best method I could find - mainly because of the convenience of being able to cycle through the processing of the data using repeat n + 1 etc - any method not using a repeating field would have been many time more laborious and hence too slow to use. As it is this procedure - running server side - generally only takes .5 sec from a mobile device - so ti is sufficiently efficient for the purpose.

      Pros: fast enough, easy to script

      Cons: none known

       

      So there are my starters - I look forward to hearing what other folk use these invaluable features for.

       

      Cheers, Nick

        • 1. Re: In praise of repeating fields and repeating global variables
          beverly

          I would say in lieu of 'arrays', the repeating fields and variables are close ( but no cigar ). The LIST functions also help with the lack of arrays and structures. It mostly depends on what you do with the stored values whether repeating values are best or LIST values or related values.

           

          Don't dismiss any of FileMaker's functionality. It can be used for what it does, you just have to decide what works for your solution.

           

          Beverly

          • 2. Re: In praise of repeating fields and repeating global variables
            DamianKelly

            aarrgghhh You did my reply :-)

             

            I was going to launch into an array would be nice rant. Repeating variables come close and are very very fast. You can even use them as a key value pair if use code() and char() to encode and decode the key into the rep.

             

            Repeating fields for real data? No not ever.

            • 3. Re: In praise of repeating fields and repeating global variables
              wimdecorte

              DamianKelly wrote:

               

              You can even use them as a key value pair if use code() and char() to encode and decode the key into the rep.

               

               

               

              aka "Named Buckets" ... I have a slide on that in my Devcon preso.

              • 4. Re: In praise of repeating fields and repeating global variables
                DamianKelly

                Set you up nicely for that plug there :-)

                • 5. Re: In praise of repeating fields and repeating global variables
                  DanielShanahan

                  I often use repeating fields for icons, which seems to be pretty common.

                   

                   

                  I also use repeats for fields I call "filtering fields."  For example, instead of

                  dateFrom_g
                  dateTo_g
                  

                   

                  I'll have

                  dateRange_g
                  

                  with two repeats.  On a report layout home page (i.e. a bunch of buttons that produce a report), I'll have the label-field combination:

                  Date From: dateRange_g

                  Date To: dateRange_g[2]

                   

                  Certainly not revolutionary, but it does minimize by filter fields in a table.

                  • 6. Re: In praise of repeating fields and repeating global variables
                    PaulTurnbull

                    We do this extensively in our main solution, however in the rewrite currently underway we're moving all the icons into styled objects.

                    • 7. Re: In praise of repeating fields and repeating global variables
                      fmpros

                      After lots of investigation, rolled my own scheduler, bascially a calendar with built in funtionality for multiple daily items.  Has a day and week view.  Based all the calendar mainpulations using FileMaker built in Date functions and repeating fields for the daily views/events.  Why didn't I simply use one of the many fine calendars out there that you can "plugin" to your app?  1) I know MY code intimately, 2) my codebase for the module is MUCH smaller and VERY fast. 3) I can modify it to my hearts content.....and repeating fields made it very easy.  Didn't go the 42 little daily portal route either.  Just write a good stock of re-useable low level functions that manipulate repeating fields.  Do as much calculation in memory "array" vars as possible and then write it out to the repeating fields.  Add script triggers and SQL and away you go. 

                       

                      More built in routines to "array-ize" repeating fields would be welcome.

                      • 8. Re: In praise of repeating fields and repeating global variables
                        Oliver_Reid

                        We need a real up to 3-dimensional ( at least) array field type.

                         

                        .....To save e.g, a five year calendar (m,d,y) in 3-d array.

                         

                        The we need an array caclulation result type - so you can store array data inside an array cell.

                         

                        The the ability to "implode" , "explode" (to borrow PHP pharsing) and search for specifc values within an array.

                         

                        The abaliity move array data to and from an FM table simply.

                         

                        Arrays are more powerful that subscipted variables -- beacuse they reserve slots for empty cells and thus enable adding two arrays together, vector products, and matrix alegbra, linear programming etc,

                         

                        Also loading the needed data from a found set into array in memory or in single field (that could be done server side) at one shot would make doing math on it (expecially if numeric array elements were stored as binary) very fast - e.g. for satisical calculations .

                         

                        ....Collapsing an array along one or more dimensions using  aggragate functions and then writing the result back into a table ....

                         

                        ......Maintaining a transposed version of all the indexed fields in retatively static table .... for very rapid searching for specific records by field value....

                         

                         

                        .....Array to/from XML functions ....to/from JSON ...

                         

                         

                        E.g.  Paypal returns transaction outcomes as JSON -- It would be so nice it be able to decode that easily.

                         

                         

                         

                        May be there is a plugin out there that does all this?

                        • 9. Re: In praise of repeating fields and repeating global variables
                          DamianKelly

                          Once you can put an array in an array you can have as many dimensions as you require. Assuming you can carry on nesting arrays within other arrays (I am unaware of any language that once you can next an array with an array you can not continue this until you run out of memory.....)

                           

                          Transforms, such as to and from arrays could almost certainly handled with custom funcations as most people do with XML and JSON pasing currently.

                           

                          A recordset to array and vice versa would be very awesome (again once you can move a foundset into an array its the same function to move a find into an array).

                           

                          A lot of these functions could be gained by improving the Set Variable [] function or by creating a new Define Variable [] function. The Define Variable would be a better route. Given FileMaker already has repeating variables it would seem sensible to extend this into array like functionality rather than creating a distinct construct.