8 Replies Latest reply on Dec 4, 2009 8:42 AM by philmodjunk

    Can I control which 10 of 50 repeating items I show with a script

    ianmanning

      Title

      Can I control which 10 of 50 repeating items I show with a script

      Post

      I have a field with 50 repetitions but I only have room to show 10 on the form, I know in the field setup I can choose which records I show ie 1..10 15..25 etc Is there a way to change this with a script so that I can add an up and down arrow above the field.

      I would have thought that filemaker would have included a scroll for repeating fields.

      I'm using FM10 Pro Advanced.

      Thanks

      Ian

        • 1. Re: Can I control which 10 of 50 repeating items I show with a script
          philmodjunk
            

          "I would have thought that filemaker would have included a scroll for repeating fields."

          Well, in a way they did. It's called a portal. A portal is tool for displaying one or more related records and can include a scroll bar. I'd take a serious look at using a related table instead of repeating fields for this. It opens up a whole range of possibilities that are difficult to impossible to do with repeating fields.

           

          There are ways to do what you describe with calculation fields that return different repetitions of a given repeating field based on a value entered in another field, but it's a heck of a lot of work compared to simply using a portal with a table of related records.

          • 2. Re: Can I control which 10 of 50 repeating items I show with a script
            ianmanning
              

            Thanks for the reply PhilModJunk, I had thought of a portal but it was just the first 2 digits of the postcode for a salesmans region and the key to the new table would be longer than the related data, so in the end I just added 5 narrow columns each showing 10 repetitions.

            I will send my request to filemaker for either a scroll bar or script access to the field setup.

            Regards

            Ian

            • 3. Re: Can I control which 10 of 50 repeating items I show with a script
              philmodjunk
                

              Can you give an example of what you are doing here?

               

              I can't quite picture why anything other than a very simple key would be needed for this relationship. Perhaps, there's a simpler approach than you anticipate here.

              • 4. Re: Can I control which 10 of 50 repeating items I show with a script
                mrvodka
                  

                Use a hidden tab control with 5 tab panels. Put the rep field in the same position on each panel and start them from 1,11,21,31,41 with 10 reps.

                1-10

                11-20

                21-30

                31-40

                41-50.

                 

                 

                Now you can create buttons ( your arrow up / down ) to navigate between the tab panels using Go to Object and some scripting. 

                After its all set up, you can make the tab panels hidden by using a fixed width of zero pixels and no line as well as NO pen width and pattern.

                • 5. Re: Can I control which 10 of 50 repeating items I show with a script
                  Steve Wright
                    

                  Depending on how the data is referenced / used / linked you may not necessarily need a key field, you could just use a cartesian join  ( X ) to get all the results into a portal.  For this you can use any field from the base table in the left join and the rep field on the right.

                   

                  But like I say, it depends on what you are trying to achieve. 

                   

                   

                  • 6. Re: Can I control which 10 of 50 repeating items I show with a script
                    ianmanning
                      

                    Thanks for all the replies.

                    This is a very small part of a large quotation database (Business quotes not "We will fight them on the beaches...) the database is made up of many related tables ie. Quotes, cusomters, line items. There is also a related database of 131000 products which has list prices, net prices, delivery times, descriptions etc.

                    As part of the reporting process I need to send the external sales people an email notifying them of any new quotes for their territory. The territory is divided by postcode so I simply needed to have a list of the first 2 digits of the postcodes that are in each sales person’s territory then I can match the customer by their post code. I already have a table for personnel so adding the repeating field here was the simplest solution. Having another table holding sales person and 2 digit post code seemed excessive. So I effectively have a grid (I wanted to say table but it may have been confusing) 10 rows by 5 columns each column is 2 characters wide on my personnel layout. This works OK, the personnel layout is hidden from general users. 

                     

                    I was more interested if the repeating field could be controlled with a script for future use where all repetitions can not be shown on a layout either physically or aesthetically. 

                    Thanks again for all your help but please don’t waste precious time on an unimportant query.

                    Best regards

                    Ian

                     

                    • 7. Re: Can I control which 10 of 50 repeating items I show with a script
                      comment_1
                        

                      Ian Manning wrote:
                      I simply needed to have a list of the first 2 digits of the postcodes that are in each sales person’s territory then I can match the customer by their post code.

                      You could use a text field (non-repeating), and enter the codes as a return-separated list. A text field can have a scrollbar attached to it.

                       

                       


                      Ian Manning wrote:

                       

                      I was more interested if the repeating field could be controlled with a script


                      Not directly - but you could use a repeating calculation field to display only selected repetitions. This is not very difficult, but you'd be able to "scroll" only by buttons. Another way would be to construct a portal to show the repeating values - but then you could just as well put the values in a related table to begin with.

                       


                      • 8. Re: Can I control which 10 of 50 repeating items I show with a script
                        philmodjunk
                          

                        Hey it's your database so do what makes sense to you, but...

                         

                        "I simply needed to have a list of the first 2 digits of the postcodes that are in each sales person’s territory then I can match the customer by their post code."

                        Seems made to order for a related table were the relationship can automatically filter the list of postal codes for you and would appear to be much less work than all the scripting and layout work you're needing to do in order to make this work with repeating fields.

                         

                        Note that a "grid" effect can be created with a series of portals, with one portal for each column of your grid if you want that effect on your layout.